Skip to content

Keyboard

<Sheet.Content className="sheet">
<input placeholder="Card number" />
{/* stays clear of the on-screen keyboard automatically */}
</Sheet.Content>

iOS resizes visualViewport, not the layout viewport, when the keyboard opens. scrollsheet listens to it and writes the inset to --scrollsheet-keyboard, no prop required.

The panel’s bottom overdraw covers the area exposed as the keyboard moves. Keyboard behavior should still be checked on the devices and embedded browsers your app supports.

Set keyboardExpands on Sheet.Root to move to the tallest detent when the keyboard opens. When it closes, the sheet returns to its previous detent unless a drag or controlled change moved it in the meantime.

This requires a measured keyboard inset. Focusing a desktop input does not expand the sheet.

Top, left, and right panels stay pinned to their edge. The keyboard inset adds bottom clearance to [data-scrollsheet-body] and scroll-padding to the panel, so focused fields can scroll above the keyboard.

On a phone, focus a field near the bottom and watch the sheet make room for the keyboard.

<Sheet.Content fill> stretches the body to the panel as a flex column. Use it for a fixed header and an independently scrolling list:

<Sheet.Content fill className="sheet">
<div className="search">{/* fixed */}</div>
<div className="results">{/* flex: 1; min-height: 0; overflow-y: auto */}</div>
</Sheet.Content>

The list then sizes to whatever the sheet has left, including when the keyboard caps the panel at the visual viewport.

fill is off by default because it changes how the content detent measures: with it on, the detent and content-morph both read the content’s natural size across all of the body’s children (margins included) instead of the body’s own stretched box.

Apply the same layout in CSS:

.sheet { display: flex; flex-direction: column; }
.sheet [data-scrollsheet-body] { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet .results { flex: 1; min-height: 0; overflow-y: auto; }

[data-scrollsheet-body] wraps your content. The fill prop applies these two rules.