# Bottom Sheet

A bottom sheet with default and lg sizes, drag gestures, keyboard handling and optional glass material.

Page: https://sui.draco.dev/docs/components/bottom-sheet

BottomSheet presents supporting content from the bottom edge, following iOS sheets: the `default` size rests at up to half the available height, like the iOS medium detent, and the `lg` size fills it, like the large detent. It builds on the Base UI [Drawer](/docs/components/drawer) for modality, focus, Escape and outside presses, and runs its own sizing gestures.

### Example: bottom-sheet-demo

```tsx
"use client";

import {
  BottomSheet,
  BottomSheetBody,
  BottomSheetClose,
  BottomSheetContent,
  BottomSheetHeader,
  BottomSheetTitle,
  BottomSheetTrigger,
} from "@workspace/ui/components/bottom-sheet";
import { Button } from "@workspace/ui/components/button";
import { CheckIcon } from "lucide-react";
import { useState } from "react";
import type { ExampleProps } from "../types";

const languages = [
  ["English", "English"],
  ["简体中文", "Chinese, Simplified"],
  ["繁體中文", "Chinese, Traditional"],
  ["日本語", "Japanese"],
  ["한국어", "Korean"],
  ["Español", "Spanish"],
  ["Français", "French"],
  ["Deutsch", "German"],
  ["Italiano", "Italian"],
  ["Português", "Portuguese"],
  ["Русский", "Russian"],
  ["Türkçe", "Turkish"],
  ["Tiếng Việt", "Vietnamese"],
  ["Bahasa Indonesia", "Indonesian"],
] as const;

export default function Example({ locale }: ExampleProps) {
  const chinese = locale === "zh-CN";
  const [language, setLanguage] = useState("English");
  // Choices apply on Done; Cancel leaves the current language unchanged.
  const [draft, setDraft] = useState(language);
  return (
    <BottomSheet
      onOpenChange={(open) => {
        if (open) setDraft(language);
      }}
    >
      <BottomSheetTrigger render={<Button variant="outline" />}>
        {chinese ? `语言：${language}` : `Language: ${language}`}
      </BottomSheetTrigger>
      <BottomSheetContent>
        <BottomSheetHeader className="grid grid-cols-[1fr_auto_1fr] items-center gap-2">
          <BottomSheetClose
            render={
              <Button
                variant="ghost"
                size="sm"
                className="justify-self-start"
              />
            }
          >
            {chinese ? "取消" : "Cancel"}
          </BottomSheetClose>
          <BottomSheetTitle>{chinese ? "语言" : "Language"}</BottomSheetTitle>
          <BottomSheetClose
            render={<Button size="sm" className="justify-self-end" />}
            onClick={() => setLanguage(draft)}
          >
            {chinese ? "完成" : "Done"}
          </BottomSheetClose>
        </BottomSheetHeader>
        <BottomSheetBody className="gap-1 px-3">
          {languages.map(([name, english]) => (
            <button
              key={name}
              type="button"
              aria-pressed={draft === name}
              onClick={() => setDraft(name)}
              className="flex items-center gap-3 rounded-2xl px-3 py-2.5 text-start transition-colors hover:bg-muted aria-pressed:bg-muted"
            >
              <span className="grid flex-1">
                <span className="font-medium">{name}</span>
                <span className="text-muted-foreground text-xs">{english}</span>
              </span>
              {draft === name && <CheckIcon className="size-4" />}
            </button>
          ))}
        </BottomSheetBody>
      </BottomSheetContent>
    </BottomSheet>
  );
}
```

## Installation

```bash
npx shadcn@latest add @sui/bottom-sheet
```

With pnpm, Yarn or Bun, use `pnpm dlx`, `yarn dlx` or `bunx --bun` in place of `npx`, and `pnpm add`, `yarn add` or `bun add` in place of `npm install`.

Install with the shadcn CLI or use the shared `@workspace/ui` package. Follow the [installation guide](/docs/installation) to configure the registry, load styles, and choose import aliases.

## Usage

```tsx showLineNumbers
import {
  BottomSheet,
  BottomSheetBody,
  BottomSheetClose,
  BottomSheetContent,
  BottomSheetDescription,
  BottomSheetFooter,
  BottomSheetHeader,
  BottomSheetTitle,
  BottomSheetTrigger,
} from "@workspace/ui/components/bottom-sheet"
```

```tsx showLineNumbers
<BottomSheet>
  <BottomSheetTrigger render={<Button variant="outline" />}>Open</BottomSheetTrigger>
  <BottomSheetContent>
    <BottomSheetHeader>
      <BottomSheetTitle>Language</BottomSheetTitle>
      <BottomSheetDescription>Drag up to see more.</BottomSheetDescription>
    </BottomSheetHeader>
    <BottomSheetBody>{/* Content */}</BottomSheetBody>
    <BottomSheetFooter>
      <BottomSheetClose render={<Button variant="secondary" />}>
        Close
      </BottomSheetClose>
    </BottomSheetFooter>
  </BottomSheetContent>
</BottomSheet>
```

## Composition

```text
BottomSheet
├── BottomSheetTrigger
└── BottomSheetContent
    ├── BottomSheetHeader
    │   ├── BottomSheetTitle
    │   └── BottomSheetDescription
    ├── BottomSheetBody
    │   └── BottomSheetExpandedContent
    └── BottomSheetFooter
        └── BottomSheetClose
```

`BottomSheetContent` composes the portal, overlay, viewport and popup, and adds a grabber unless `showGrabber={false}`. `BottomSheetPortal`, `BottomSheetOverlay` and `BottomSheetGrabber` are also exported.

## Sizes

The sheet sizes to its content. The `default` size takes at most half the available height, which excludes the top safe area and the software keyboard. When content outgrows it, the sheet becomes expandable to the `lg` size, which uses the full available height.

- `detents="auto"` (default): one size while content fits `default`, and `lg` once it does not.
- `detents="always"`: keeps `lg` even for short content.
- `detents={false}`: a single size fitted to content; when space runs out it uses the full height and the body scrolls.

When the `default` size cannot hold the header, the footer and at least 80px of body, the sheet uses the full height instead. Control the size with `size`, `defaultSize` and `onSizeChange`, or read and change it with `useBottomSheet()`.

### Example: bottom-sheet-detents

```tsx
"use client";

import {
  BottomSheet,
  BottomSheetBody,
  BottomSheetClose,
  BottomSheetContent,
  BottomSheetDescription,
  type BottomSheetDetents,
  BottomSheetFooter,
  BottomSheetHeader,
  BottomSheetTitle,
  BottomSheetTrigger,
} from "@workspace/ui/components/bottom-sheet";
import { Button } from "@workspace/ui/components/button";
import type { ExampleProps } from "../types";

const options: { detents: BottomSheetDetents; rows: number }[] = [
  { detents: "auto", rows: 3 },
  { detents: "always", rows: 3 },
  { detents: false, rows: 24 },
];

export default function Example({ locale }: ExampleProps) {
  const chinese = locale === "zh-CN";
  const copy = {
    auto: chinese
      ? ["自动", "内容放得下时只有一档，超过 default 档才增加 lg 档。"]
      : [
          "Auto",
          "One size while content fits; lg appears once it outgrows default.",
        ],
    always: chinese
      ? ["始终两档", "即使内容较少，也保留 lg 档。"]
      : ["Always", "Keeps lg even for short content."],
    single: chinese
      ? ["单档", "按内容自适应高度，放不下时占满可用高度并滚动。"]
      : [
          "Single",
          "Sizes to content and scrolls at the full available height.",
        ],
  };
  return (
    <div className="flex flex-wrap justify-center gap-3">
      {options.map(({ detents, rows }) => {
        const [label, description] =
          copy[detents === false ? "single" : detents];
        return (
          <BottomSheet key={String(detents)} detents={detents}>
            <BottomSheetTrigger render={<Button variant="outline" />}>
              {label}
            </BottomSheetTrigger>
            <BottomSheetContent>
              <BottomSheetHeader>
                <BottomSheetTitle>{label}</BottomSheetTitle>
                <BottomSheetDescription>{description}</BottomSheetDescription>
              </BottomSheetHeader>
              <BottomSheetBody>
                {Array.from({ length: rows }, (_, index) => (
                  <div
                    // biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows.
                    key={index}
                    className="h-10 shrink-0 rounded-xl bg-muted"
                  />
                ))}
              </BottomSheetBody>
              <BottomSheetFooter>
                <BottomSheetClose
                  render={<Button variant="secondary" size="lg" />}
                >
                  {chinese ? "关闭" : "Close"}
                </BottomSheetClose>
              </BottomSheetFooter>
            </BottomSheetContent>
          </BottomSheet>
        );
      })}
    </div>
  );
}
```

## Gestures

| Action | Result |
| --- | --- |
| Press the grabber | Toggles an expandable sheet between `default` and `lg`. |
| Drag the header up | Expands; the sheet stops at `lg`. |
| Drag the header down from `lg` | Returns to `default`. |
| Drag down from `default`, or a single-size sheet | Closes past the close distance or with a downward flick, otherwise springs back. |
| Swipe up on the body at `default` | Expands, consuming the gesture without scrolling or pressing an item. |
| Scroll the wheel down on the body at `default` | Expands and absorbs the rest of that wheel gesture. |
| Pull down from the top of the body at `lg` | Returns to `default`, as with the header. |

A press becomes a drag after 6px of mostly vertical movement. Release chooses the size from the position, the final direction and the velocity: a flick moves one size in its direction, a pause drops the momentum, and reversing direction counts the last direction. The sheet then springs to that size carrying the release velocity; pressing it mid-glide catches it where it is. Size changes from the grabber, keyboard or content glide over 500ms on the same curve the sheet enters with, and reduced motion moves in place. A drag never presses the control it started on. Fields, sliders, the footer and elements marked `data-bottom-sheet-no-drag` keep their own gestures.

At `default` the body of an expandable sheet does not scroll. Scrolling starts once the sheet reaches `lg` and its animation has finished, and returning to `default` resets the scroll position.

## Buttons and modality

Following Apple's [sheet guidelines](https://developer.apple.com/design/human-interface-guidelines/sheets), put Cancel on the leading edge of the header and Done on the trailing edge, and pair Done with Cancel, or with Back in the later steps of a multi-step flow. Close dismisses without saving and can stand alone. When people swipe away a sheet with unsaved changes, decline the close in `onOpenChange` and confirm first.

Set `modal={false}` for a nonmodal sheet, such as a formatting panel: it shows no overlay and leaves the page behind it usable. Add `disablePointerDismissal` to keep it open while people work behind it.

## Header and footer

The body scrolls between the header and the footer. While there is more to scroll, its content fades out under the header and above the footer, so neither needs a background or a divider. Set `collapseOnScroll` on `BottomSheetHeader` to fold its description while scrolling and restore it at the top. With `footerMode="adaptive"` (default) the footer scrolls with the body once both no longer fit; `footerMode="fixed"` always keeps it in place. `BottomSheetExpandedContent` renders only while the sheet is expanded.

## Keyboard and fields

A text field that takes focus expands an expandable sheet to `lg`, unless `expandOnInputFocus={false}`. With `keyboard="resize"` (default) the sizes fit the space above a software keyboard; `keyboard="lift"` keeps the sheet's own height and raises it above the keyboard. Pass `initialFocus={false}` to `BottomSheetContent` to keep the keyboard closed when the sheet opens. In this example, closing also waits until the name is saved.

### Example: bottom-sheet-form

```tsx
"use client";

import {
  BottomSheet,
  BottomSheetBody,
  BottomSheetClose,
  BottomSheetContent,
  BottomSheetHeader,
  BottomSheetTitle,
  BottomSheetTrigger,
} from "@workspace/ui/components/bottom-sheet";
import { Button } from "@workspace/ui/components/button";
import { Input } from "@workspace/ui/components/input";
import { useState } from "react";
import type { ExampleProps } from "../types";

export default function Example({ locale }: ExampleProps) {
  const chinese = locale === "zh-CN";
  const copy = chinese
    ? {
        trigger: "重命名",
        title: "重命名",
        hint: "键盘弹出时整张面板抬到键盘上方，保存期间不能关闭。",
        label: "文件名",
        cancel: "取消",
        save: "保存",
        saving: "保存中…",
        initial: "季度报告",
      }
    : {
        trigger: "Rename",
        title: "Rename",
        hint: "The whole sheet rises above the keyboard and stays open while saving.",
        label: "File name",
        cancel: "Cancel",
        save: "Save",
        saving: "Saving…",
        initial: "Quarterly report",
      };
  const [open, setOpen] = useState(false);
  const [name, setName] = useState(copy.initial);
  const [saving, setSaving] = useState(false);
  return (
    <BottomSheet
      open={open}
      // Closing waits until the name is saved.
      onOpenChange={(next) => {
        if (!saving) setOpen(next);
      }}
      detents={false}
      keyboard="lift"
    >
      <BottomSheetTrigger render={<Button variant="outline" />}>
        {copy.trigger}
      </BottomSheetTrigger>
      <BottomSheetContent initialFocus={false}>
        <BottomSheetHeader className="grid grid-cols-[1fr_auto_1fr] items-center gap-2">
          <BottomSheetClose
            disabled={saving}
            render={
              <Button
                variant="ghost"
                size="sm"
                className="justify-self-start"
              />
            }
          >
            {copy.cancel}
          </BottomSheetClose>
          <BottomSheetTitle>{copy.title}</BottomSheetTitle>
          <Button
            size="sm"
            className="justify-self-end"
            disabled={!name.trim() || saving}
            onClick={() => {
              setSaving(true);
              window.setTimeout(() => {
                setSaving(false);
                setOpen(false);
              }, 1200);
            }}
          >
            {saving ? copy.saving : copy.save}
          </Button>
        </BottomSheetHeader>
        <BottomSheetBody className="pb-6">
          <Input
            aria-label={copy.label}
            value={name}
            onChange={(event) => setName(event.target.value)}
          />
          <p className="text-muted-foreground">{copy.hint}</p>
        </BottomSheetBody>
      </BottomSheetContent>
    </BottomSheet>
  );
}
```

## Closing and content

Swipes, Escape, outside presses, `BottomSheetClose` and the platform back gesture all ask to close through `onOpenChange`. With a controlled `open`, the application can decline, for example while a request is busy, and the sheet returns to its size. An application's own back button can close the sheet by setting `open` to `false`.

While animating out, the sheet keeps its last content, so clearing data in the parent cannot flash an empty sheet. The next opening starts at `defaultSize`. Changing `contentKey` returns the sheet to `default` with its body at the top, which suits steps within one sheet.

### Example: bottom-sheet-steps

```tsx
"use client";

import {
  BottomSheet,
  BottomSheetBody,
  BottomSheetClose,
  BottomSheetContent,
  BottomSheetHeader,
  BottomSheetTitle,
  BottomSheetTrigger,
} from "@workspace/ui/components/bottom-sheet";
import { Button } from "@workspace/ui/components/button";
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
import { useState } from "react";
import type { ExampleProps } from "../types";

const regions = {
  asia: {
    en: ["Asia", ["Tokyo", "Seoul", "Singapore", "Shanghai", "Bangkok"]],
    zh: ["亚洲", ["东京", "首尔", "新加坡", "上海", "曼谷"]],
  },
  europe: {
    en: ["Europe", ["London", "Paris", "Berlin", "Madrid", "Rome"]],
    zh: ["欧洲", ["伦敦", "巴黎", "柏林", "马德里", "罗马"]],
  },
  americas: {
    en: ["Americas", ["New York", "Toronto", "Mexico City", "São Paulo"]],
    zh: ["美洲", ["纽约", "多伦多", "墨西哥城", "圣保罗"]],
  },
  oceania: {
    en: ["Oceania", ["Sydney", "Melbourne", "Auckland"]],
    zh: ["大洋洲", ["悉尼", "墨尔本", "奥克兰"]],
  },
} as const;

type Region = keyof typeof regions;

export default function Example({ locale }: ExampleProps) {
  const language = locale === "zh-CN" ? "zh" : "en";
  const chinese = language === "zh";
  const [open, setOpen] = useState(false);
  const [region, setRegion] = useState<Region | null>(null);
  const [city, setCity] = useState<string | null>(null);
  const [regionName, cities] = region ? regions[region][language] : [];
  const row =
    "flex items-center justify-between rounded-2xl px-4 py-3 text-start font-medium transition-colors hover:bg-muted";
  // The first step offers Cancel; later steps go Back instead.
  const leading = region ? (
    <Button
      variant="ghost"
      size="sm"
      className="justify-self-start"
      onClick={() => setRegion(null)}
    >
      <ChevronLeftIcon data-icon="inline-start" />
      {chinese ? "返回" : "Back"}
    </Button>
  ) : (
    <BottomSheetClose
      render={
        <Button variant="ghost" size="sm" className="justify-self-start" />
      }
    >
      {chinese ? "取消" : "Cancel"}
    </BottomSheetClose>
  );
  return (
    <BottomSheet
      open={open}
      onOpenChange={setOpen}
      onOpenChangeComplete={(next) => {
        if (!next) setRegion(null);
      }}
      // Each step starts at the default size, at the top of its list.
      contentKey={region ?? "regions"}
    >
      <BottomSheetTrigger render={<Button variant="outline" />}>
        {city ?? (chinese ? "选择城市" : "Choose a city")}
      </BottomSheetTrigger>
      <BottomSheetContent>
        <BottomSheetHeader className="grid grid-cols-[1fr_auto_1fr] items-center gap-2">
          {leading}
          <BottomSheetTitle>
            {regionName ?? (chinese ? "地区" : "Region")}
          </BottomSheetTitle>
        </BottomSheetHeader>
        <BottomSheetBody className="gap-1 px-3 pb-6">
          {cities?.map((name) => (
            <button
              key={name}
              type="button"
              className={row}
              onClick={() => {
                setCity(name);
                setOpen(false);
              }}
            >
              {name}
            </button>
          ))}
          {!region &&
            (Object.keys(regions) as Region[]).map((key) => (
              <button
                key={key}
                type="button"
                className={row}
                onClick={() => setRegion(key)}
              >
                {regions[key][language][0]}
                <ChevronRightIcon className="size-4 text-muted-foreground" />
              </button>
            ))}
        </BottomSheetBody>
      </BottomSheetContent>
    </BottomSheet>
  );
}
```

## Material

The sheet spans the full width within the safe area. At `default` it floats with an 8px margin on each side and below; the margin fades out gradually while the sheet expands, following a drag, so at `lg` it meets the edges. Pass `frosted` or `glass` to `BottomSheetContent` to put the sheet at `default` on [Glass](/docs/components/glass); frosted glass keeps it legible over busy content. It turns opaque as it expands, so a full-height sheet reads as a solid page. Override `--bottom-sheet-gap`, `--bottom-sheet-radius` and `--bottom-sheet-max-width` through `className`; a maximum width centers the sheet on large screens.

### Example: bottom-sheet-glass

```tsx
"use client";

import {
  BottomSheet,
  BottomSheetBody,
  BottomSheetClose,
  BottomSheetContent,
  BottomSheetDescription,
  BottomSheetExpandedContent,
  BottomSheetHeader,
  BottomSheetTitle,
  BottomSheetTrigger,
} from "@workspace/ui/components/bottom-sheet";
import { Button } from "@workspace/ui/components/button";
import {
  ClockIcon,
  NavigationIcon,
  PhoneIcon,
  StarIcon,
  XIcon,
} from "lucide-react";
import type { ExampleProps } from "../types";

export default function Example({ locale }: ExampleProps) {
  const chinese = locale === "zh-CN";
  const hours = chinese
    ? ["周一至周五 7:00–22:00", "周六 8:00–23:00", "周日 8:00–21:00"]
    : ["Mon–Fri 7:00–22:00", "Sat 8:00–23:00", "Sun 8:00–21:00"];
  const reviews = chinese
    ? ["日落时分景色很美。", "咖啡不错，周末人多。", "适合散步，停车方便。"]
    : [
        "Beautiful at sunset.",
        "Good coffee, busy on weekends.",
        "Easy parking and a nice walk.",
      ];
  return (
    <div className="grid w-full justify-items-center overflow-hidden rounded-2xl bg-[url(/playground/backgrounds/coast-poster.jpg)] bg-center bg-cover px-6 py-16">
      <BottomSheet detents="always">
        <BottomSheetTrigger render={<Button />}>
          {chinese ? "查看地点" : "View place"}
        </BottomSheetTrigger>
        <BottomSheetContent frosted>
          <BottomSheetHeader collapseOnScroll className="pe-14">
            <BottomSheetTitle className="text-xl">
              {chinese ? "海岸瞭望台" : "Coast Lookout"}
            </BottomSheetTitle>
            <BottomSheetDescription>
              {chinese
                ? "观景台 · 步行 12 分钟 · 4.8 分"
                : "Viewpoint · 12 min walk · 4.8 rating"}
            </BottomSheetDescription>
            <BottomSheetClose
              aria-label={chinese ? "关闭" : "Close"}
              render={
                <Button
                  variant="secondary"
                  size="icon-sm"
                  className="absolute inset-e-4 top-5 rounded-full"
                />
              }
            >
              <XIcon />
            </BottomSheetClose>
          </BottomSheetHeader>
          <BottomSheetBody>
            <div className="grid grid-cols-3 gap-2">
              <Button variant="secondary" className="h-14 flex-col gap-1">
                <NavigationIcon />
                {chinese ? "路线" : "Directions"}
              </Button>
              <Button variant="secondary" className="h-14 flex-col gap-1">
                <PhoneIcon />
                {chinese ? "致电" : "Call"}
              </Button>
              <Button variant="secondary" className="h-14 flex-col gap-1">
                <StarIcon />
                {chinese ? "收藏" : "Save"}
              </Button>
            </div>
            <p className="text-muted-foreground">
              {chinese
                ? "向上拖动查看营业时间和评价。展开后玻璃逐渐变为不透明。"
                : "Drag up for hours and reviews. The glass turns opaque as the sheet expands."}
            </p>
            <BottomSheetExpandedContent className="grid gap-4">
              <section className="grid gap-2">
                <h3 className="flex items-center gap-2 font-medium">
                  <ClockIcon className="size-4" />
                  {chinese ? "营业时间" : "Hours"}
                </h3>
                {hours.map((line) => (
                  <p key={line} className="text-muted-foreground">
                    {line}
                  </p>
                ))}
              </section>
              <section className="grid gap-2">
                <h3 className="font-medium">{chinese ? "评价" : "Reviews"}</h3>
                {[...reviews, ...reviews, ...reviews].map((review, index) => (
                  <p
                    // biome-ignore lint/suspicious/noArrayIndexKey: repeated sample copy.
                    key={index}
                    className="rounded-2xl bg-muted/60 px-4 py-3"
                  >
                    {review}
                  </p>
                ))}
              </section>
            </BottomSheetExpandedContent>
          </BottomSheetBody>
        </BottomSheetContent>
      </BottomSheet>
    </div>
  );
}
```

## API reference

### BottomSheet

Accepts Base UI Drawer Root props, except snap points and swipe direction.

| Prop | Type | Default / behavior |
| --- | --- | --- |
| `open`, `defaultOpen`, `onOpenChange` | Base UI | Open state; `onOpenChange` can decline a close. |
| `detents` | `"auto" \| "always" \| false` | `"auto"`. |
| `size`, `defaultSize` | `"default" \| "lg"` | `"default"`. |
| `onSizeChange` | `(size) => void` | Called when the size changes. |
| `expandOnInputFocus` | `boolean` | `true`. |
| `keyboard` | `"resize" \| "lift"` | `"resize"`. |
| `footerMode` | `"adaptive" \| "fixed"` | `"adaptive"`. |
| `contentKey` | `React.Key` | Resets the size and scroll position when it changes. |
| `labels` | `{ expand?: string; collapse?: string }` | Grabber labels. |
| `feedback` | `FeedbackOption` | Follows `FeedbackProvider`; haptics when settling on a detent. |
| `BottomSheetContent` `glass`, `frosted` | `boolean \| GlassConfig`, `boolean` | Optional glass material. |

### BottomSheetContent

Accepts Base UI Drawer Popup props, such as `initialFocus` and `finalFocus`, plus `showGrabber` (default `true`).

### BottomSheetHeader

Accepts div props plus `collapseOnScroll` (default `false`).

### useBottomSheet

Returns `open`, `size`, `expandable`, `expanded`, `setSize` and `toggle` for the surrounding sheet.
