UI

Bottom sheet

A modal sheet that rises from the bottom edge and rests at configurable viewport-height detents.

import { BottomSheet } from '@uthereal/ui/bottom-sheet'

Bottom sheet playground

Loading interactive preview…

Overview

BottomSheet renders a modal surface anchored to the bottom edge that rests at one to four viewport-height stops (detents). It requires a title, accepts an optional description, and renders children inside a body beneath a draggable header with a grabber handle and corner close button. While open, focus lands on the sheet and stays trapped inside, background content is inert (except live regions), page scroll locks, and closing returns focus to the trigger or the previously focused element.

The surface caps its width at min(100%, 36rem) centered in the viewport, extends 160px below the fold so upward rubber-banding never exposes a gap, and shows a scroll hairline under the header once the body scrolls. A single MotionValue drives both the sheet's vertical offset and the backdrop opacity with zero per-frame React re-renders.

Use BottomSheet for secondary tasks where a partial peek is useful before committing to the full view: trip details, share options, filters, or media queues. Use Dialog for interrupting decisions and Drawer for edge-anchored side panels on wide layouts.

Usage

'use client'
import { useState } from 'react'
import { BottomSheet } from '@uthereal/ui/bottom-sheet'
import { Button } from '@uthereal/ui/button'

export function TripDetailsSheet() {
  return (
    <BottomSheet
      title="Trip details"
      description="Flight LX 318 · Zurich to London Heathrow."
      triggerLabel="Show trip details"
    >
      <p>Boarding starts at 14:15 at Gate A42.</p>
    </BottomSheet>
  )
}

export function ControlledFilterSheet() {
  const [open, setOpen] = useState(false)
  const [detent, setDetent] = useState(0)

  return (
    <>
      <Button
        label="Open filters"
        variant="outline"
        onAction={() => setOpen(true)}
      />
      <BottomSheet
        title="Filters"
        open={open}
        onOpenChange={setOpen}
        detents={[0.35, 0.7, 0.95]}
        detent={detent}
        onDetentChange={setDetent}
      >
        <p>Current stop index: {detent}</p>
      </BottomSheet>
    </>
  )
}

Omit triggerLabel (or pass renderTrigger={null}) to control visibility solely through open and onOpenChange.

Examples

Detents

detents accepts one to four fractions of the viewport height between 0.15 and 0.98. Values sort ascending on resolution so defaultDetent, detent, and onDetentChange always index the sorted order.

DetentsStopsTypical use
[0.6]SingleShort action lists or summaries without peek expansion.
[0.45, 0.92]TwoDefault peek-and-expand view for details or filters.
[0.35, 0.7, 0.95]ThreeRich inspectors or maps that benefit from a mid stop.

Behavior and labels

Set defaultDetent to open at a higher stop, customize expandLabel, collapseLabel, and closeLabel for localized assistive text, or set motion="none" for immediate snap transitions with dragging disabled.

Gestures

With motion enabled (default), one MotionValue controls vertical position and feeds a useTransform backdrop dim (1.0 at the tallest detent, 0.78 at the smallest detent, 0 when closed):

GestureEffect
Drag header or grabber downward (mouse, pen, or touch)Follows the pointer 1:1 toward lower detents and dismissal.
Drag upward past the tallest detentApplies iOS-style rubber-band resistance approaching 120px; releases at zero velocity.
Release after draggingProjects position 0.2s ahead (y + v * 0.2) and snaps to the nearest detent or close.
Flick faster than 320 px/sAdvances at least one detent in the flick direction; flicking down from stop 0 closes.
Touch drag on body below the tallest detentDrags the sheet directly instead of scrolling the body.
Touch drag on body at the tallest detentScrolls the body natively; pulling down from scrollTop === 0 hands back to sheet drag.
Wheel scroll down on body below the tallest detentExpands the sheet to its tallest detent before scrolling content.
Press interactive control in header (excluding grabber)Ignored by the header pointer handler so buttons and links activate normally.

Collapsing below the tallest detent resets body scroll to the top so the peek always shows the start of the content. Catching a leaving sheet mid-exit reverses it from its current position without flashing.

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
titleRequiredstring—Heading of the sheet, required: it names the sheet for assistive technology.
descriptionstring—Supporting text under the title, announced when it opens.
detentsnumber[]Default: [0.45,0.92]Resting heights as fractions of the viewport height, 0.15 to 0.98 each, one to four of them. They sort ascending; the sheet opens at defaultDetent and never grows past the largest. The default [0.45, 0.92] peeks at less than half the screen and expands to most of it.
defaultDetentintegerDefault: 0Index into the sorted detents the sheet opens at. 0 (the default) is the smallest; the keyboard, a drag or scrolling moves between detents.
triggerLabelstring—Label of the default trigger button. Omit it when the sheet opens through state alone.
closeLabelstringDefault: "Close"Accessible name of the close button, e.g. "Close sheet".
expandLabelstringDefault: "Expand sheet"Accessible name of the grabber handle while collapsed, e.g. "Expand sheet".
collapseLabelstringDefault: "Collapse sheet"Accessible name of the grabber handle while expanded, e.g. "Collapse sheet".
defaultOpenbooleanDefault: falseInitial open state. Later argument edits do not reset an existing instance.
recipestudio | softDefault: "studio"Visual treatment. Both recipes use the same interaction behavior.
themeBottomSheetTheme—Color mode, accent, and modal tokens (padding, titleSize, backdropBlur, sheetRadius, surfaceRadius, overlay, borderStrong). See Theming for all keys and defaults.
motionnone | subtle | expressiveDefault: "subtle"Detent animation preset. System reduced-motion preferences take precedence.
motionOptionsBottomSheetMotionOptions—The detent transition, Arc's smooth spring by default; a release keeps its velocity into the next detent or the exit. Durations are milliseconds.
dirltr | rtl—Reading direction. Omit it to inherit the page direction.

React integration

PropPurpose
refForwarded to the portalled sheet surface HTMLDivElement.
childrenSheet body content rendered below the header.
open / onOpenChange(open)Controlled open state and change callback.
detent / onDetentChange(index)Controlled resting detent index (into sorted detents) and change callback.
renderTrigger(props, state)Custom trigger renderer; spread props onto a focusable element. Pass null to omit the trigger.
renderIcon(name, context)Custom icon renderer for slot: 'trigger' or slot: 'close'. Keep icons decorative.
presetApplication defaults merged below instance props.
tokens--ui-* CSS variables applied after the typed theme on the trigger and surface.
classNameClass name appended to the sheet surface.
portalContainerPortal target, such as an element inside a native <dialog> top layer.

Keyboard & accessibility

KeyContextInteraction
Enter, SpaceTriggerOpen the sheet.
Enter, SpaceGrabber buttonToggle between the smallest and tallest detent (multi-detent sheets).
ArrowUp / ArrowDownGrabber buttonStep up or down one detent.
Home / EndGrabber buttonJump to the tallest or smallest detent.
ArrowDown, PageDown, SpaceSheet or bodyExpand to the tallest detent first, then scroll the body down.
ArrowUp, PageUp, Shift+SpaceSheet or bodyScroll the body up.
Tab / Shift+TabInside sheetMove focus inside the sheet; auto-expands when focusing below the fold.
EscapeInside sheetClose the sheet and return focus to the trigger or previous element.

The surface renders with role="dialog" and aria-modal="true", labelled by title and described by description. Multi-detent sheets expose the grabber as a focusable <button> with aria-expanded and expandLabel / collapseLabel; single-detent sheets render the bar as decorative so screen readers do not announce a no-op toggle. A polite live region (role="status", aria-live="polite") announces "Sheet expanded", "Sheet collapsed", or "Sheet at N percent height" whenever the resting detent changes.

Nested overlays opened inside a sheet portal into it through LayerContext and stack above it, with Escape closing the topmost layer first. All layout, borders, padding, and corner radii use logical CSS properties and mirror under dir="rtl". Under forced-colors: active, the sheet border, scroll hairline, and grabber bar retain visible ButtonText contrast.

Motion and theming

Detent settling and dismissal run on Arc's smooth spring (0.4s, bounce 0, zero overshoot) by default, preserving finger velocity on release. motion="expressive" uses the morph spring (0.42s, bounce 0.16), and motionOptions.transition overrides the spring or tween (durations in milliseconds). A ResizeObserver tracks dynamic viewport height (dvh) changes from mobile toolbars or rotation and refits the sheet to its active detent without jarring jumps.

Under prefers-reduced-motion: reduce, detents jump immediately without travel, open and close crossfade opacity over 120 ms, backdrop blur is removed, and CSS transitions turn off. Setting motion="none" snaps open, close, and detent changes immediately (0 ms) and disables pointer and touch dragging.

Theme tokenCSS variableDefaultRole
padding--ui-modal-padding24pxHeader and body padding scale (16px inline ≤640 px).
titleSize--ui-modal-title-size18pxHeading font size.
backdropBlur--ui-modal-backdrop-blur0pxOptional backdrop blur radius (0 disables blur).
sheetRadius--ui-modal-sheet-radius22pxTop corner radius (18px on viewports ≤640 px).
overlay--ui-overlaythemeBackdrop tint color driven by sheet position.
borderStrong--ui-border-strongthemeResting grabber bar fill.
surfaceRaised--ui-surface-raisedthemeSheet surface background color.

theme also accepts mode, accent, and core color, border, typography, and shadow tokens. Trigger and close buttons inherit recipe, mode, accent, motion, dir, and tokens.

Composition

In an agent composition, BottomSheet is a container whose children render inside its body, and its resting detent index is host state.

{
  "type": "BottomSheet",
  "props": {
    "title": "Trip details",
    "description": "Flight LX 318 · Zurich to London Heathrow.",
    "triggerLabel": "Show trip details",
    "detents": [0.45, 0.92]
  },
  "children": ["boarding-summary", "gate-info"]
}

On this page