Micro-interactions

Sheet

A bottom sheet with three heights: peek, half and full. Drag the header and let go. The sheet carries the speed of your hand forward and snaps to the height it was heading for, so a short flick from the bottom can reach the top. Pull it past either end and it stretches like a rubber band. Above peek the page behind dims and steps back. A pull or a flick past the bottom closes it. Arrow keys on the handle step between heights, and Escape closes.

Install

bun add motion

Props

PropTypeDefaultDescription
peeknumber24Height of the lowest stop, as a share of the container.
halfnumber56Height of the middle stop, as a share of the container.
stiffnessnumber320Spring tension of the snap. Higher lands sooner.
dampingnumber32Spring friction. Low values bounce at the stop before they settle.
rubberBandnumber0.55How far the sheet gives when you pull it past its ends. 0 is a hard stop.
backdropnumber0.5How dark the page behind gets when the sheet is at full height.
recedebooleantrueThe page behind scales back a little as the sheet rises.
dismissiblebooleantrueA pull or a flick past the lowest stop closes the sheet. Off, the lowest stop is the floor.
accentColorstring (hex)"#a855f7"The focus ring on the handle.

What It Demonstrates

Drag
Moving an element by grabbing it, often with momentum when released.
Momentum
Motion that carries velocity, especially after a drag or interruption.
Rubber-banding
Resistance and snap-back when you drag past a boundary (the iOS overscroll feel).
Spring
Motion driven by physics (tension, mass, damping) rather than a set duration.
Velocity
How fast and in which direction an element is moving. A spring carries it into the next animation when interrupted, so a flicked element keeps its speed.
Swipe to dismiss
Dragging an element off-screen to close it, like a drawer or toast.
Interruptible animation
An animation that can be smoothly redirected mid-flight instead of finishing first.

Related Components

Appears In