Skip to content

Bottom sheet

A sheet that rests at a peek or full height and follows your finger.

OverlayGestureMotion
npx shadcn@latest add @silicon-ui/bottom-sheet

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/bottom-sheet

Manually

  1. Install the dependencies

    npm install @radix-ui/react-dialog lucide-react motion
  2. Copy these files into your project

    • components/silicon-ui/bottom-sheet/bottom-sheet.tsx
    • components/silicon-ui/bottom-sheet/bottom-sheet.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/lib/escape.ts
    • components/silicon-ui/lib/return-focus.ts
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { BottomSheet } from "@/components/silicon-ui/bottom-sheet/bottom-sheet";

API reference

BottomSheet

PropTypeDefault
title*string—
children*ReactNode—
trigger

The control that opens the sheet, usually a button. Focus returns to it when the sheet closes.

ReactNode—
openboolean—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
descriptionstring—
detents

Resting heights as fractions of the viewport height. The sheet opens at `initialDetent` and never grows past the largest.

number[]—
initialDetent

Index into the sorted detents the sheet opens at. Defaults to the smallest.

number—
onDetentChange(index: number) => void—
closeLabelstring—
classNamestring—

BottomSheetClose

Accepts the props of ButtonHTMLAttributes.

Dependencies

npm
@radix-ui/react-dialoglucide-reactmotion
Registry
silicon-motion-tokens