@erkamyaman/capacitor-foldable
Fold state, posture, hinge angle, size classes and bar placement for foldable phones such as Galaxy Z Fold and Flip, Pixel Fold and iPhone Duo, in Capacitor apps.
| π Documentation | API | iPhone Duo guide | Hinge Guess demo |
| Ionic tabs on iPhone Duo without the plugin | With the plugin |
|---|---|
![]() |
![]() |
npm install @erkamyaman/capacitor-foldable
npx cap sync| Capacitor | Plugin | Install | iOS |
|---|---|---|---|
| v9 beta | v9.x beta | npm install @erkamyaman/capacitor-foldable@next |
Size classes and iPhone Duo, iOS 16+. Setup in the release notes |
| v8.x | v8.x | npm install @erkamyaman/capacitor-foldable |
Size classes, plus iPhone Duo on Capacitor 8.5+ and iOS 27.1, built with any Xcode |
| v7.x | v7.x | npm install @erkamyaman/capacitor-foldable@latest-7 |
Size classes only |
Android works on API 24+ with any foldable Jetpack WindowManager supports. The web build is a stub that reports flat.
import { Foldable } from '@erkamyaman/capacitor-foldable';
const { posture } = await Foldable.getFoldState(); // 'flat' | 'tabletop' | 'book'
Foldable.addListener('foldStateChange', ({ posture }) => {
document.documentElement.dataset.posture = posture;
});Prefer CSS? installFoldablePolyfill() fills in the Device Posture and Viewport Segments APIs that Capacitor's web views turn off, and sets --fold-* variables and classes on <html>. Using ion-tabs? import '@erkamyaman/capacitor-foldable/ionic-tabs.css'.
Everything else is in the documentation.
npx skills add erkamyaman/capacitor-foldable@capacitor-foldableAlso ships in the npm package under skills/, and on its own at iphone-duo-capacitor-skills.
- Capacitor Native UI and Ionic Theme iOS 27 by rdlabo
- RecipeSage, a collaborative recipe keeper and meal planner, moves its native tab bar to the side on iPhone Duo with it
- AI Gist, a privacy-first AI prompt manager, moves its tab bar to the side rail on iPhone Duo with it, alongside rdlabo's theme
- Hinge Guess, a game where the phone's hinge is the controller
This plugin is MIT licensed, and that covers the work in this repository. Quoted passages from Apple's and Google's documentation belong to them and are used here to explain their guidance.
iPhone and iPhone Duo are trademarks of Apple Inc., registered in the U.S. and other countries. Android and Pixel are trademarks of Google LLC. Galaxy Z Fold and Galaxy Z Flip are trademarks of Samsung Electronics Co., Ltd. This project is not affiliated with, endorsed by, or sponsored by any of them; the names appear only to say which devices the plugin works with.

