API reference
Generated from the JSDoc in src/definitions.ts. Back to the docs.
Promise<{ foldable: boolean; supportsTabletop: boolean; }>
**Since:** 7.0.0
--------------------
### getFoldState()
```typescript
getFoldState() => PromisePromise<FoldState>
**Since:** 7.0.0
--------------------
### getHingeAngle()
```typescript
getHingeAngle() => Promise<{ angle: number | null; status: HingeStatus | null; }>
```
Read the angle between the two halves of the device, in degrees: `0` when
closed, `180` when flat. Resolves to `{ angle: null }` on devices without a
hinge angle sensor, on web, and on iOS before 27.1.
**Returns:** Promise<{ angle: number | null; status: HingeStatus | null; }>
**Since:** 7.0.0
--------------------
### getReservedRegions()
```typescript
getReservedRegions() => Promise<{ regions: ReservedRegion[]; }>
```
Read every region the system reserves on this display: the fold and
anything covering the screen, active or not. iPhone Duo reports the fold,
the vertical status bar area and the under-display camera. Resolves to an
empty list on Android, on web and on iOS before 27.1.
**Returns:** Promise<{ regions: ReservedRegion[]; }>
**Since:** 8.2.0
--------------------
### setVerticalBarBehavior(...)
```typescript
setVerticalBarBehavior(options: { behavior: 'automatic' | 'disabled'; }) => Promise<{ applied: boolean; }>
```
Choose whether iPhone Duo may move this app's bars to the side of the
display. `'disabled'` keeps everything horizontal, including the status
bar. Resolves to `{ applied: false }` when the app does not use
`FoldableBridgeViewController`, on Android, on web and on iOS before 27.1.
See the iPhone Duo guide for the one-line storyboard change.
| Param | Type |
| ------------- | ----------------------------------------------------- |
| **`options`** | { behavior: 'automatic' \| 'disabled'; } |
**Returns:** Promise<{ applied: boolean; }>
**Since:** 8.2.0
--------------------
### getSizeClass()
```typescript
getSizeClass() => PromisePromise<SizeClass>
**Since:** 7.0.0
--------------------
### getDisplayModes()
```typescript
getDisplayModes() => PromisePromise<DisplayModes>
**Since:** 7.0.0
--------------------
### getBarPlacement()
```typescript
getBarPlacement() => PromisePromise<BarPlacement>
**Since:** 7.0.0
--------------------
### startRearDisplay()
```typescript
startRearDisplay() => Promise{ url: string; } |
**Since:** 7.0.0
--------------------
### stopDualScreen()
```typescript
stopDualScreen() => Promise'foldStateChange' |
| **`listenerFunc`** | (state: FoldState) => void |
**Returns:** Promise<PluginListenerHandle>
**Since:** 7.0.0
--------------------
### addListener('hingeAngleChange', ...)
```typescript
addListener(eventName: 'hingeAngleChange', listenerFunc: (event: { angle: number; }) => void) => Promise'hingeAngleChange' |
| **`listenerFunc`** | (event: { angle: number; }) => void |
**Returns:** Promise<PluginListenerHandle>
**Since:** 7.0.0
--------------------
### addListener('sizeClassChange', ...)
```typescript
addListener(eventName: 'sizeClassChange', listenerFunc: (sizeClass: SizeClass) => void) => Promise'sizeClassChange' |
| **`listenerFunc`** | (sizeClass: SizeClass) => void |
**Returns:** Promise<PluginListenerHandle>
**Since:** 7.0.0
--------------------
### addListener('displayModeChange', ...)
```typescript
addListener(eventName: 'displayModeChange', listenerFunc: (modes: DisplayModes) => void) => Promise'displayModeChange' |
| **`listenerFunc`** | (modes: DisplayModes) => void |
**Returns:** Promise<PluginListenerHandle>
**Since:** 7.0.0
--------------------
### addListener('foldingChange', ...)
```typescript
addListener(eventName: 'foldingChange', listenerFunc: (event: { folding: boolean; }) => void) => Promise'foldingChange' |
| **`listenerFunc`** | (event: { folding: boolean; }) => void |
**Returns:** Promise<PluginListenerHandle>
**Since:** 8.2.0
--------------------
### addListener('barPlacementChange', ...)
```typescript
addListener(eventName: 'barPlacementChange', listenerFunc: (placement: BarPlacement) => void) => Promise'barPlacementChange' |
| **`listenerFunc`** | (placement: BarPlacement) => void |
**Returns:** Promise<PluginListenerHandle>
**Since:** 7.0.0
--------------------
### Interfaces
#### FoldState
| Prop | Type | Description | Since |
| ---------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`state`** | 'flat' \| 'half-opened' \| 'closed' | Posture of the fold. `'closed'` is never reported today: a device shut on its cover display reports `'flat'`. | 7.0.0 |
| **`isSeparating`** | boolean | Whether the fold splits the web view into two areas: `true` when half-opened, or when the hinge has a physical gap. | 7.0.0 |
| **`posture`** | 'flat' \| 'tabletop' \| 'book' | How the device is held: `'tabletop'` when half-opened with a horizontal hinge, like a laptop, `'book'` when half-opened with a vertical hinge, and `'flat'` otherwise. | 7.0.0 |
| **`hingeOrientation`** | 'horizontal' \| 'vertical' | Direction of the hinge relative to the window, so it flips when the device rotates. Omitted when there is no fold. | 7.0.0 |
| **`hingeBounds`** | { x: number; y: number; width: number; height: number; } | Position of the fold in CSS pixels, relative to the web view. Zero wide (or zero tall) on a seamless fold. Omitted when there is no fold. | 7.0.0 |
| **`occludedBounds`** | { x: number; y: number; width: number; height: number; } | Area of the web view the hinge covers, in CSS pixels. Only present on devices with a physical gap. | 7.0.0 |
| **`activeDisplay`** | 'inner' \| 'outer' | Which display is showing the app, on a device with an inner and an outer display such as iPhone Duo. Reported on iPhone Duo (iOS 27.1 or later) and omitted elsewhere. | 7.0.0 |
| **`cameraBounds`** | { x: number; y: number; width: number; height: number; }[] | Areas of the web view something covers, in CSS pixels. On Android these are the display cutouts. On iPhone Duo these are the active occlusion regions: the camera in use, and the strip the system keeps for the vertical status bar. Use `getReservedRegions()` when you need to tell them apart. Omitted when there are none. | 7.0.0 |
| **`hingeMargins`** | { top: number; right: number; bottom: number; left: number; } | Space the system asks you to keep clear around the fold, in CSS pixels. `hingeBounds` covers the crease plus these margins, so the crease itself is `hingeBounds` shrunk by them. iPhone Duo reports 20 on each side of a vertical fold. Omitted on Android and where there is no fold. | 8.2.0 |
#### ReservedRegion
| Prop | Type | Description | Since |
| -------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **`kind`** | 'division' \| 'occlusion' | `'division'` is the fold itself. `'occlusion'` is something covering the display, such as a camera or the vertical status bar area. | 8.2.0 |
| **`isActive`** | boolean | Whether the region applies right now. An inactive division is a flat fold, and an inactive occlusion is a camera that is not in use. | 8.2.0 |
| **`x`** | number | | |
| **`y`** | number | | |
| **`width`** | number | | |
| **`height`** | number | | |
| **`margins`** | { top: number; right: number; bottom: number; left: number; } | Space to keep clear around the region, in CSS pixels. | 8.2.0 |
#### SizeClass
| Prop | Type | Description | Since |
| ----------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`horizontal`** | 'compact' \| 'regular' | Width size class of the window: `'compact'` on a phone and on the outer display of a foldable, `'regular'` on the inner display, tablets and wide windows. On Android and web `'regular'` starts at 600 CSS pixels. | 7.0.0 |
| **`vertical`** | 'compact' \| 'regular' | Height size class of the window: `'compact'` on a phone in landscape. On Android and web `'regular'` starts at 480 CSS pixels. | 7.0.0 |
| **`widthClass`** | 'compact' \| 'medium' \| 'expanded' \| 'large' \| 'extraLarge' | Material window width class, from the window width in CSS pixels: `'compact'` below 600, `'medium'` below 840, `'expanded'` below 1200, `'large'` below 1600 and `'extraLarge'` from 1600. | 7.0.0 |
| **`heightClass`** | 'compact' \| 'medium' \| 'expanded' | Material window height class, from the window height in CSS pixels: `'compact'` below 480, `'medium'` below 900 and `'expanded'` from 900. | 7.0.0 |
#### DisplayModes
| Prop | Type | Description | Since |
| ----------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`rearDisplay`** | DisplayModeStatus | Rear display mode moves the app to the outer display, so people can frame a photo with the rear cameras. Only on Android foldables that offer it. | 7.0.0 |
| **`dualScreen`** | DisplayModeStatus | Dual-screen mode shows a second page on the outer display while the app stays on the inner one. Only on Android foldables that offer it. | 7.0.0 |
#### BarPlacement
| Prop | Type | Description | Since |
| --------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`verticalBarEdge`** | 'leading' \| 'trailing' \| null | The edge iPhone Duo moves tab bars and toolbars to when it lays them out vertically: `'leading'` or `'trailing'` in the reading direction, so `'leading'` is the left edge in left-to-right languages. `null` when bars stay horizontal, and always on Android, web and iOS before 27.1. An app built with an older Xcode still gets the edge: it is inferred from the safe-area inset the bar leaves, since the trait that names it is missing. | 7.0.0 |
| **`inset`** | number | How much room the vertical bar takes on its edge, in points, rounded to whole points. It is the same value the web view reports as a safe-area inset, so `env(safe-area-inset-*)` already covers simple layouts. Read it when you place your own chrome and need the number itself, and do not assume it stays at 84: it differs when the bar is disabled, and Apple can change it. `0` when no vertical bar is reported, and always on Android and web. | 8.3.3 |
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| **`remove`** | () => Promise<void> |
### Type Aliases
#### HingeStatus
How far open the hinge is, as the system sees it. Note that it can lag the
angle: iOS keeps reporting `'closed'` for a moment after the phone opens.
'closed' | 'partiallyOpen' | 'fullyOpen'
#### DisplayModeStatus
'unsupported' | 'unavailable' | 'available' | 'active'
</docgen-api>