Bottom sheet

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

npx shadcn@latest add @silicon-ui/bottom-sheet
overlaygesturemotion
Loading…

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. Shared files are skipped if you already have them.

    • components/silicon-ui/bottom-sheet/bottom-sheet.tsx
    • components/silicon-ui/bottom-sheet/bottom-sheet.module.css
    • components/silicon-ui/lib/escape.ts shared
    • components/silicon-ui/lib/return-focus.ts shared
  3. Install the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

Source codetsx
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