<!-- generated by scripts/gen-docs.mjs from docs/system/sheet.md. Edit the source and rerun. -->
# Sheet

## Description
A panel that slides in from the edge of the screen.

`import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetBody, SheetFooter, SheetTitle, SheetDescription, SheetClose } from "@/components/cobalt/ui/sheet"`, source `registry/cobalt/ui/sheet.tsx`, status `ready-with-gaps`.
Foundation: `shadcn sheet (base-luma, base)`, on Base UI `Drawer`. Traps checked: `trap/overlay-title`, `trap/overlay-focus-return`, `trap/overlay-conditional-render`, `trap/exit-eats-input`, `trap/escape-nested`, `trap/overlay-destructive` (n/a: a sheet does not confirm; that is AlertDialog), `trap/overlay-pending-dismiss` (n/a: the sheet has no `status`; a sheet with a submit in flight is a gap, see the report), `trap/overlay-no-max-height`, `trap/open-trigger-unfocused`, `trap/scroll-chain`, `trap/viewport-height`, `trap/safe-area`, `trap/touch-autofocus`, `trap/motion-origin`, `trap/motion-exit-slower`, `trap/reduced-motion-ignored`, `trap/motion-frequent` (n/a: tier mid in `.design-system/review/surfaces.tsv`).

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| Base UI `Drawer`, which is its `Dialog` with a swipe that dismisses: a portalled `role="dialog"` popup named by its `Title`, focus in on open and back to the trigger on close, Escape and an outside press to close, `data-starting-style` and `data-ending-style` for the transition; the swipe, tracked on its `Viewport`, which moves the popup through `--drawer-swipe-movement-x` and `-y`, clears the backdrop through `--drawer-swipe-progress`, marks both `data-swiping`, closes on a release past half the sheet or at 0.5px per ms or faster toward its edge and settles back otherwise, waits until a scrolled body is at its top before a downward drag moves the sheet, and ignores a mouse drag inside `Drawer.Content` so text stays selectable | `side`, with `left` and `right` floating inset by 10px at 448px wide from 640px up and becoming bottom sheets below that, capped at `90svh` and padded by `env(safe-area-inset-bottom)`; `bottom` and `top` full width on a phone and, from 640px up, a 448px panel centred 10px from their edge, so a share or a notice never stretches its field and its button across the window (`registry/cobalt/ui/sheet.tsx:565-569`); the swipe direction set from `side`, down for every sheet that rises from the bottom, up for a top sheet and toward its edge for a side sheet from 640px up, so a sheet always leaves the way it came (`registry/cobalt/ui/sheet.tsx:526`); the grabber, `SheetGrabber`, 36 by 4 in a strip 24px deep on the edge the sheet is swiped from, which a mouse can drag too, and none on a side sheet from 640px up (`registry/cobalt/ui/sheet.tsx:578-583`); a slow swipe that the drawer lets go back once it has carried the sheet 30 percent of its size is closed from where the finger left it, the drawer's own release being half (`swipeCloses` and `useSheetShareRule`, `registry/cobalt/ui/sheet.tsx:38` and `registry/cobalt/ui/sheet.tsx:434`, decided by trying both, `.design-system/evidence/sheet/phone-sheet-family-2026-10-17.json`); the family the sheet heads: below 640px a Popover, a DropdownMenu, a ContextMenu, a Select and a Combobox rise as the same sheet, with the same grabber, corners, shadow, motion classes (`sheetMotionClasses`, `registry/cobalt/ui/sheet.tsx:68`) and swipe, given to the popups Base UI's Drawer does not draw by `useSheetSwipe` (`registry/cobalt/ui/sheet.tsx:156`), so their keys, typeahead and focus stay their own; the sheet following the finger with no easing, and a flick leaving faster by the swipe's strength; the second click of the double-click that opened the sheet dropped, so it presses and closes nothing (`guardOpeningClick`, `registry/cobalt/ui/overlay.tsx:50`); `overlay`, `true`, `false` or `"phone"`, which dims only below 640px; the shared `Overlay` on the sheet's duration, clearing as the sheet is swiped (`sheetScrimClasses`, `registry/cobalt/ui/sheet.tsx:72`); the portal container and the inert page from `registry/cobalt/lib/portal.tsx`; `SheetBody`, the one part that scrolls, with `overscroll-contain` and 4px of padding above and below given back by a negative margin, so the first and last control's focus ring is not clipped by the scroll edge and the 24px to the header and footer holds, and a tab stop only while it overflows through `useScrollTabStop` from `registry/cobalt/lib/scroll-focus.ts` (`registry/cobalt/ui/sheet.tsx:624-636`); the slide on `--t-sheet` and `--curve-sheet`, leaving on `--t-leave`, a fade on `--t-fade` under reduced motion; `shadow-sheet`, one soft shadow and no edge line, shared with the dialogs; the title at `text-base font-semibold`; the corner close as a ghost `icon-sm` Button with no fill at rest, which fills on hover, centred on the title's first line at any text size and on the trailing side in either direction (`registry/cobalt/ui/sheet.tsx:594-596`), with the header padded clear of it so a long title wraps before it; a top sheet capped at `90svh` like the bottom one, so its footer stays on screen; the body's rows never shrinking and its own focus ring drawn inside, where the sheet cannot clip it (`registry/cobalt/ui/sheet.tsx:636`); `SheetDescription` scrolling on its own past eight lines, so a long one never takes the body's room; `overflow-wrap: anywhere` on the panel, so an address or a file name breaks rather than run past the edge |

## Examples
Filters in a sheet from the right whose body scrolls, a share sheet from the bottom, and an editor that leaves the page undimmed from 640px up. On a phone each of them rises from the bottom with a grabber, and a swipe down closes it as Cancel would.

Real uses, 0 call sites (`rg -n "<Sheet\b" app docs/system/examples --glob '!docs/system/examples/sheet/*'`): the showcase chrome renders no Sheet of its own yet, and the examples folder does not count.

Uses inside the registry, which other components build on (planned as product uses once the first screen lands on the system):
- `Popover` renders it below 640px, and `FilterBar` holds every filter in it.
- `DropdownMenu`, `ContextMenu`, `Select` and `Combobox` take its grabber, its motion and scrim classes and `useSheetSwipe` for the sheets they become below 640px, so the six read as one family.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/sheet/default.tsx` | default | Filters for a reading list, chosen in the sheet and applied from its footer |
| Not applicable: the right side is default.tsx | side=right | A 448px panel inset from the right edge, a bottom sheet below 640px |
| `docs/system/examples/sheet/side-left.tsx` | side=left | From the left, for a list of places to go |
| `docs/system/examples/sheet/side-bottom.tsx` | side=bottom | From the bottom, as tall as its content; a 448px panel from 640px up |
| `docs/system/examples/sheet/side-top.tsx` | side=top | From the top, as tall as its content; a 448px panel from 640px up |
| Not applicable: the dimmed page is default.tsx | overlay=true | The scrim behind the sheet at every width |
| `docs/system/examples/sheet/beside-the-page.tsx` | overlay=phone | An editor that leaves the page undimmed from 640px up, so the name it changes stays in view |
| Not applicable: false belongs to a sheet with `modal={false}`, and every example here is modal | overlay=false | The page undimmed and live behind the sheet |
| Not applicable: the open state is reached by pressing any trigger | state:open | The sheet slid in, focus on its first control or the body |
| Not applicable: closing is reached with Escape, the scrim, Cancel, the corner close or a swipe | state:closing | The sheet slides out on the leave time while the scrim fades |
| Not applicable: swiping is reached on any example on a phone, or with the mouse on the grabber of the share sheet | state:swiping | The sheet follows the finger and the scrim clears with it |
| Not applicable: scrolling is reached in default.tsx on a phone, where 12 rows pass the body | state:scrolling | The body scrolls between the header and the footer and becomes a tab stop |
| Not applicable: the tiles show each side, and the examples each overlay | matrix:side,overlay | Every side with every overlay setting |
| `docs/system/examples/sheet/default.tsx` | composition:Checkbox | Each filter is a Checkbox row in the body that scrolls |

Example: Filters for a reading list, chosen in the sheet and applied from its footer (`docs/system/examples/sheet/default.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import { Checkbox } from "@/components/cobalt/ui/checkbox";
import { Label } from "@/components/cobalt/ui/label";
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/cobalt/ui/sheet";

const filters = [
  "Unread",
  "Starred",
  "Shared with me",
  "Has notes",
  "Added this week",
  "Added this month",
  "Archived",
  "Flagged",
  "Mentions me",
  "Has a due date",
  "Overdue",
  "Done",
];

// The choices are a draft until Apply; Cancel, Escape and the scrim leave the list as it was.
function Filters({ applied, onApply }: { applied: readonly string[]; onApply: (chosen: string[]) => void }) {
  const [chosen, setChosen] = useState<ReadonlySet<string>>(() => new Set(applied));
  return (
    <>
      <SheetHeader>
        <SheetTitle>Filters</SheetTitle>
        <SheetDescription>Narrow the list. Nothing changes until you apply.</SheetDescription>
      </SheetHeader>
      <SheetBody className="flex flex-col gap-px">
        {filters.map((filter) => (
          <Label key={filter} variant="row">
            <Checkbox
              checked={chosen.has(filter)}
              onCheckedChange={(checked) => {
                setChosen((was) => {
                  const next = new Set(was);
                  if (checked) next.add(filter);
                  else next.delete(filter);
                  return next;
                });
              }}
            />
            {filter}
          </Label>
        ))}
      </SheetBody>
      {/* Stacked for the thumb on a phone; one row at the end from 640px up, where the sheet is a panel. */}
      <SheetFooter className="sm:flex-row sm:justify-end">
        <SheetClose render={<Button variant="ghost" />}>Cancel</SheetClose>
        <SheetClose render={<Button />} onClick={() => onApply(filters.filter((filter) => chosen.has(filter)))}>
          {chosen.size === 0 ? "Apply" : `Apply ${chosen.size} ${chosen.size === 1 ? "filter" : "filters"}`}
        </SheetClose>
      </SheetFooter>
    </>
  );
}

export default function Example() {
  const [applied, setApplied] = useState<string[]>([]);
  return (
    <div className="flex flex-wrap items-center gap-3">
      <Sheet>
        <SheetTrigger render={<Button variant="secondary" />}>Filters</SheetTrigger>
        <SheetContent>
          <Filters applied={applied} onApply={setApplied} />
        </SheetContent>
      </Sheet>
      <p role="status" className="min-w-0 text-sm text-muted-foreground">
        {applied.length === 0 ? "No filters on." : `Filtered by ${applied.join(", ")}.`}
      </p>
    </div>
  );
}
```

Example: Each filter is a Checkbox row in the body that scrolls (`docs/system/examples/sheet/default.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import { Checkbox } from "@/components/cobalt/ui/checkbox";
import { Label } from "@/components/cobalt/ui/label";
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/cobalt/ui/sheet";

const filters = [
  "Unread",
  "Starred",
  "Shared with me",
  "Has notes",
  "Added this week",
  "Added this month",
  "Archived",
  "Flagged",
  "Mentions me",
  "Has a due date",
  "Overdue",
  "Done",
];

// The choices are a draft until Apply; Cancel, Escape and the scrim leave the list as it was.
function Filters({ applied, onApply }: { applied: readonly string[]; onApply: (chosen: string[]) => void }) {
  const [chosen, setChosen] = useState<ReadonlySet<string>>(() => new Set(applied));
  return (
    <>
      <SheetHeader>
        <SheetTitle>Filters</SheetTitle>
        <SheetDescription>Narrow the list. Nothing changes until you apply.</SheetDescription>
      </SheetHeader>
      <SheetBody className="flex flex-col gap-px">
        {filters.map((filter) => (
          <Label key={filter} variant="row">
            <Checkbox
              checked={chosen.has(filter)}
              onCheckedChange={(checked) => {
                setChosen((was) => {
                  const next = new Set(was);
                  if (checked) next.add(filter);
                  else next.delete(filter);
                  return next;
                });
              }}
            />
            {filter}
          </Label>
        ))}
      </SheetBody>
      {/* Stacked for the thumb on a phone; one row at the end from 640px up, where the sheet is a panel. */}
      <SheetFooter className="sm:flex-row sm:justify-end">
        <SheetClose render={<Button variant="ghost" />}>Cancel</SheetClose>
        <SheetClose render={<Button />} onClick={() => onApply(filters.filter((filter) => chosen.has(filter)))}>
          {chosen.size === 0 ? "Apply" : `Apply ${chosen.size} ${chosen.size === 1 ? "filter" : "filters"}`}
        </SheetClose>
      </SheetFooter>
    </>
  );
}

export default function Example() {
  const [applied, setApplied] = useState<string[]>([]);
  return (
    <div className="flex flex-wrap items-center gap-3">
      <Sheet>
        <SheetTrigger render={<Button variant="secondary" />}>Filters</SheetTrigger>
        <SheetContent>
          <Filters applied={applied} onApply={setApplied} />
        </SheetContent>
      </Sheet>
      <p role="status" className="min-w-0 text-sm text-muted-foreground">
        {applied.length === 0 ? "No filters on." : `Filtered by ${applied.join(", ")}.`}
      </p>
    </div>
  );
}
```

## Variants

### side
- `right`: the default, a task about the page, inset at the trailing edge from 640px up and a bottom sheet below. Used at 0 call sites outside the examples.
- `left`: a list that belongs to the start of the page, such as the lists a page can switch to. Used at 0 call sites outside the examples.
- `bottom`: a bottom sheet on a phone, for a picker or a share that is as tall as its content. From 640px up it is a 448px panel centred 10px above the bottom edge, the width of a side sheet, so its field and its button never stretch across the window. A task that belongs beside the page at that width is `right`. Used at 0 call sites outside the examples.
- `top`: a notice that must be read before going on, as tall as its content: full width on a phone, a 448px panel centred under the top edge from 640px up. Used at 0 call sites outside the examples.

Example: From the left, for a list of places to go (`docs/system/examples/sheet/side-left.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/cobalt/ui/sheet";

const lists = [
  { name: "Reading list", count: 12 },
  { name: "Credit funds watchlist", count: 14 },
  { name: "Shared with me", count: 5 },
];

// Going to a list stays on the page, so it answers at once.
export default function Example() {
  const [current, setCurrent] = useState(lists[0]!);
  return (
    <div className="flex items-center gap-3">
      <Sheet>
        <SheetTrigger render={<Button variant="secondary" />}>Switch list</SheetTrigger>
        <SheetContent side="left">
          <SheetHeader>
            <SheetTitle>Lists</SheetTitle>
            <SheetDescription>Pick a list to open it.</SheetDescription>
          </SheetHeader>
          <SheetBody className="flex flex-col gap-1">
            {lists.map((list) => (
              <SheetClose
                key={list.name}
                aria-current={list.name === current.name ? "page" : undefined}
                render={<Button variant="ghost" className="justify-start" />}
                onClick={() => setCurrent(list)}
              >
                {list.name}
              </SheetClose>
            ))}
          </SheetBody>
        </SheetContent>
      </Sheet>
      <p aria-live="polite" className="text-sm text-muted-foreground">
        {current.name}, {current.count} items
      </p>
    </div>
  );
}
```

Example: From the bottom, as tall as its content; a 448px panel from 640px up (`docs/system/examples/sheet/side-bottom.tsx`)

```tsx
import { Button } from "@/components/cobalt/ui/button";
import { CopyButton } from "@/components/cobalt/ui/copy-button";
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/cobalt/ui/sheet";

const link = "https://example.com/lists/reading-list";

export default function Example() {
  return (
    <Sheet>
      <SheetTrigger render={<Button variant="secondary" />}>Share list</SheetTrigger>
      <SheetContent side="bottom">
        <SheetHeader>
          <SheetTitle>Share Reading list</SheetTitle>
          <SheetDescription>Anyone with the link can read the list. Only you can change it.</SheetDescription>
        </SheetHeader>
        <SheetBody>
          <div className="flex h-(--control) items-center gap-1 rounded-(--r-control) bg-muted ps-3 pe-1 text-sm">
            <span className="min-w-0 flex-1 truncate">{link}</span>
            <CopyButton size="icon-xs" value={link} label="Copy link" tooltipAlign="end" />
          </div>
        </SheetBody>
        <SheetFooter>
          <SheetClose render={<Button variant="secondary" />}>Done</SheetClose>
        </SheetFooter>
      </SheetContent>
    </Sheet>
  );
}
```

Example: From the top, as tall as its content; a 448px panel from 640px up (`docs/system/examples/sheet/side-top.tsx`)

```tsx
import { CloudOffIcon } from "@/components/cobalt/icon";
import { Button } from "@/components/cobalt/ui/button";
import {
  Sheet,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/cobalt/ui/sheet";

export default function Example() {
  return (
    <Sheet>
      {/* The sync status in a toolbar: pressed, it says why and what happens to the changes. */}
      <SheetTrigger render={<Button variant="secondary" />}>
        <CloudOffIcon aria-hidden="true" data-icon="inline-start" />
        Sync paused
      </SheetTrigger>
      <SheetContent side="top">
        <SheetHeader>
          <SheetTitle>Sync paused</SheetTitle>
          <SheetDescription>Changes stay on this device until you are back online.</SheetDescription>
        </SheetHeader>
        <SheetFooter>
          <SheetClose render={<Button variant="secondary" />}>Got it</SheetClose>
        </SheetFooter>
      </SheetContent>
    </Sheet>
  );
}
```

### overlay
- `phone`: the page stays readable from 640px up, where the sheet sits beside what it edits, and dims below, where the sheet covers it anyway. Used at 0 call sites outside the examples.
- true, the default, dims the page at every width, as in `docs/system/examples/sheet/default.tsx`. false leaves it undimmed at every width, for a sheet opened with `modal={false}` that the page stays live behind; under a modal sheet the page is inert, so an undimmed page would look live when it is not.

Example: An editor that leaves the page undimmed from 640px up, so the name it changes stays in view (`docs/system/examples/sheet/beside-the-page.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import { Field, FieldError, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/cobalt/ui/sheet";
import { StateButton } from "@/components/cobalt/ui/state-button";
import { useAction } from "@/lib/cobalt/use-action";

// Stands in for your API call. It answers after 900ms, and fails while the browser is offline or the
// address has ?network=offline.
const request = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

export default function Example() {
  const [open, setOpen] = useState(false);
  const [name, setName] = useState("Credit funds watchlist");
  const [draft, setDraft] = useState(name);
  const save = useAction(async (next: string) => {
    await request();
    return next;
  });
  return (
    <div className="flex items-center gap-3">
      <Sheet
        open={open}
        onOpenChange={(next) => {
          // While the change is being saved, the sheet stays until the answer comes.
          if (!next && save.status === "pending") return;
          setOpen(next);
          save.reset();
          if (next) setDraft(name);
        }}
      >
        <SheetTrigger render={<Button variant="secondary" />}>Edit details</SheetTrigger>
        <SheetContent overlay="phone">
          <form
            className="flex min-h-0 flex-1 flex-col"
            onSubmit={(event) => {
              event.preventDefault();
              const next = draft.trim() || name;
              void save.run(next).then((saved) => {
                if (saved === undefined) return;
                setName(saved);
                setOpen(false);
              });
            }}
          >
            <SheetHeader>
              <SheetTitle>Edit details</SheetTitle>
              <SheetDescription>Nothing is saved until you apply.</SheetDescription>
            </SheetHeader>
            <SheetBody>
              <Field>
                <FieldLabel>Name</FieldLabel>
                <Input value={draft} onChange={(event) => setDraft(event.target.value)} />
                {save.error !== null && (
                  <FieldError>The name was not saved. Check your connection and try again.</FieldError>
                )}
              </Field>
            </SheetBody>
            <SheetFooter className="sm:flex-row sm:justify-end">
              <SheetClose render={<Button variant="ghost" />}>Cancel</SheetClose>
              <StateButton type="submit" status={save.status} pendingLabel="Saving" failureLabel="Not saved">
                Apply
              </StateButton>
            </SheetFooter>
          </form>
        </SheetContent>
      </Sheet>
      <p aria-live="polite" className="text-sm text-muted-foreground">
        {name}
      </p>
    </div>
  );
}
```

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| closed | render, or `open={false}` | press the trigger | nothing is in the tree but the trigger | test |
| open | the trigger, or `open` | work in the body, apply, cancel, Escape, press the scrim | the panel at its side, `aria-expanded="true"` and `data-popup-open` on the trigger, the page behind inert | a11y scan |
| closing | Escape, the scrim, a `SheetClose`, `open={false}`, or a swipe let go past 30 percent of the sheet or flicked at 0.5px per ms or faster | press the trigger again once it is gone | `data-ending-style` on the panel and the scrim, which take no pointer input while they move; after a swipe the panel leaves from where the finger let go | by hand |
| swiping | a finger on the sheet, or the mouse on the grabber, moving toward the sheet's edge | let go to close it, or let go short of 30 percent of the sheet to keep it | the panel under the finger with no lag, `data-swiping` on it and on the scrim, the scrim clearing with the distance; measured on a phone moving 25px for every 25px of finger, the scrim at 0.68 a third of the way down, and a 100px drag settling back in about 400ms (`.design-system/evidence/sheet/swipe-390-and-1440.json`) | by hand |
| scrolling | the body's content taller than the panel minus header and footer | scroll the body with the wheel, a finger or the keyboard | the body clipped, `tabindex="0"` on it, the header and footer unmoved | a11y scan |
| phone | the viewport under 640px with `side="left"` or `side="right"` | the same, with the sheet rising from the bottom, and swipe it down | full width, 90svh at most, the top corners rounded, the grabber at the top, the footer padded above the home indicator | screenshot |

### State precedence
- Open and scrolling: both show. The body alone scrolls, with `overscroll-contain` so the page behind stays put (`trap/scroll-chain`), and the header and footer stay.
- Open and phone: both show. The side sheet renders as a bottom sheet and keeps its header, body and footer.
- Closing and open: closing wins. The moving layer takes no input, and a press on the trigger is a new open (`trap/exit-eats-input`).
- Swiping and scrolling: scrolling wins until the body is at its top. A finger that starts in a body scrolled down scrolls it; at the top, a drag down moves the sheet.
- Swiping and a host that keeps the sheet open: the host wins. While a save is pending the editor in beside-the-page.tsx refuses to close, and a swipe let go past 30 percent settles back.
- Closed and scrolling: Not applicable: the body is not in the tree while closed.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| closed to open | announce | `duration-sheet` on `ease-sheet`, 450ms, sliding from its own edge (`trap/motion-origin`) | translate (100 percent plus the 10px inset from the side; 100 percent up from the bottom), opacity | `motion-reduce:duration-fade`, a 150ms opacity fade with the translate dropped by `registry/cobalt/base.css:181-182`; measured `transition-duration: 0.15s` under reduce in `.design-system/evidence/sheet/open-390-and-1280.json` |
| open to closed | announce | `data-ending-style:duration-leave`, 200ms on `ease-sheet`, back the way it came (`trap/motion-exit-slower`) | translate, opacity | the 150ms fade |
| swiping | input | none: `data-swiping` turns transitions off, so the panel is where the finger is on every frame | transform, from `--drawer-swipe-movement-x` and `-y` | the same; following a finger is not an animation |
| swipe let go past the threshold | announce | the leave time multiplied by `--drawer-swipe-strength`, 0.1 to 1 from the flick's speed, on `ease-sheet`, from where the finger let go; measured a 380px drag reaching the bottom edge in about 200ms (`.design-system/evidence/sheet/swipe-390-and-1440.json`), and a slow 254px drag that only the 30 percent rule closes leaving from 254px with no frame back at rest (`.design-system/evidence/sheet/phone-sheet-family-2026-10-17.json`) | translate, transform, opacity | the 150ms fade where the finger let go, with nothing moving |
| swipe let go short of it | announce | `duration-sheet` on `ease-sheet`, back to its place | transform | back in one frame |
| scrim during a swipe | input | none: its opacity is one minus the swipe's progress | opacity | the same |
| scrim in and out | announce | `overlay-motion` on `--overlay-duration`, which the sheet sets to `--t-sheet` so the scrim lands with the panel, leaving in 70 percent of it | opacity | the same fade |

## Props

<!-- Props generated from registry/cobalt/ui/sheet.tsx with TypeScript by scripts/props-table.mjs -->
### Sheet

No props of its own.

Also accepts from Base UI: `actionsRef`, `defaultOpen`, `defaultTriggerId`, `disablePointerDismissal`, `handle`, `modal`, `onOpenChange`, `onOpenChangeComplete`, `open`, `triggerId`.

### SheetGrabber

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `className?` | `string` |  |  |

### SheetTrigger

No props of its own.

Also accepts every native `<button>` attribute; from Base UI: `handle`, `id`, `nativeButton`, `payload`, `render`.

### SheetClose

No props of its own.

Also accepts every native `<button>` attribute; from Base UI: `nativeButton`, `render`.

### SheetContent

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `closeLabel?` | `string` | `"Close"` | The accessible name of the close button in the corner. |
| `overlay?` | `boolean \| "phone"` | `true` | False leaves the page behind undimmed, for an editor that sits beside what it edits. |
| `showCloseButton?` | `boolean` | `true` |  |
| `side?` | `"top" \| "bottom" \| "right" \| "left"` | `"right"` | `right` the default; `left` a list that belongs to the start of the page; `bottom` a bottom sheet on a phone; `top` a notice that must be read before going on. |

Also accepts every native `<div>` attribute; from Base UI: `finalFocus`, `initialFocus`, `render`.

### SheetHeader

No props of its own.

Also accepts every native `<div>` attribute.

### SheetBody

No props of its own.

Also accepts every native `<div>` attribute.

### SheetFooter

No props of its own.

Also accepts every native `<div>` attribute.

### SheetTitle

No props of its own.

Also accepts every native `<h2>` attribute; from Base UI: `render`.

### SheetDescription

No props of its own.

Also accepts every native `<p>` attribute; from Base UI: `render`.

`SheetContent` adds `side`, `overlay`, `showCloseButton` (default true) and `closeLabel` (default "Close"). There is no `status`: a sheet whose footer submits reports it through `StateButton` and the host keeps `open` true until it settles. Everything on Base UI's root passes through `Sheet`: `open`, `defaultOpen`, `onOpenChange` with the reason, which is `"swipe"` after a swipe the drawer closed and `"imperative-action"` after a slow one only the 30 percent rule closed, `modal` (default true; `false` skips the inert lock), `disablePointerDismissal`, `actionsRef`. The drawer's `swipeDirection` and snap points are not props: the direction follows `side`, and a sheet is open or closed. A control inside that drags along the swipe's axis, such as a slider, takes `data-base-ui-swipe-ignore` (or `="y"` for one that drags across), so dragging it does not move the sheet. `SheetContent` passes the popup's `initialFocus` and `finalFocus` through. `SheetBody` takes a `ref`, merged with the one that watches its overflow. `className` on every part is merged last and is for placement. The scrim is `Overlay`, an internal part the sheet shares with Dialog, AlertDialog and CommandPalette; it is not imported on its own, and the sheet sets its fade to the sheet's own duration. For a popup that becomes a bottom sheet on a phone without being a Sheet, as the menus, Select and Combobox do, the file exports the family's parts: `SheetGrabber`, `sheetMotionClasses`, `sheetScrimClasses`, `phoneSheetPositionerClasses`, `phoneSheetPopupClasses`, `phoneSheetScrollClasses`, `useSheetSwipe(close)`, which returns the `popup` and `backdrop` refs, and `swipeCloses`, the release rule both swipes share.

## Usage

### When to use
- The task is a list, a set of filters, a long form or an editor that would scroll inside a dialog.
- The task belongs beside the page, so you want to see what it changes while you work.
- A picker needs to become a bottom sheet on a phone.

### When not to use
- The task is a form that fits in 288px. Use Dialog instead.
- The question is yes or no. Use AlertDialog instead.
- The content is a list of actions on one thing. Use DropdownMenu instead.
- The content is the page's own navigation. Use Nav instead.

### Rules
- Follows `rule/dialog-controlled-stays-mounted`.
- `rule/sheet-footer-row-from-640`: When a footer holds a cancel and a confirm, pass `className="sm:flex-row sm:justify-end"` to `SheetFooter` with the confirm last, instead of leaving both stacked at every width, because from 640px up the sheet is a 448px panel beside the page, where two full-width buttons stacked read as a phone screen, while on a phone stacked buttons are what the thumb reaches. Evidence: measured Cancel and Apply as two 400px buttons stacked at 1440 before, and one row at the end, 72px and 63px wide, after, `.design-system/evidence/sheet/swipe-390-and-1440.json`; single use docs/system/examples/sheet/default.tsx:62. Check: review of every `SheetFooter` with two actions.
  - Don't: `<SheetFooter><SheetClose render={<Button variant="ghost" />}>Cancel</SheetClose><Button>Apply</Button></SheetFooter>`
  - Do: `<SheetFooter className="sm:flex-row sm:justify-end"><SheetClose render={<Button variant="ghost" />}>Cancel</SheetClose><Button>Apply</Button></SheetFooter>`
- `rule/sheet-task-in-sheet-body`: When the sheet's task can be taller than the screen, put it in `SheetBody` between `SheetHeader` and `SheetFooter`, instead of letting `SheetContent` scroll, because the body alone scrolls, keeps the page behind still with `overscroll-contain`, and becomes a tab stop only while it overflows, so the title and the actions stay in view. Evidence: measured the body scrolling at 20 rows with `tabindex="0"` and no `tabindex` at 12 rows, .design-system/evidence/sheet/open-390-and-1280.json; principle wcag: 2.1.1 Keyboard, a region that scrolls must be reachable from the keyboard. Check: test `sheet.test.tsx` renders the body without a tab stop at rest; review of every `SheetContent` for a `SheetBody`.
  - Don't: `<SheetContent className="overflow-y-auto"><SheetTitle>Filters</SheetTitle>{filters.map(...)}<Button>Apply</Button></SheetContent>`
  - Do: `<SheetContent><SheetHeader><SheetTitle>Filters</SheetTitle></SheetHeader><SheetBody>{filters.map(...)}</SheetBody><SheetFooter><Button>Apply</Button></SheetFooter></SheetContent>`
- `rule/sheet-keeps-its-side-on-a-phone`: When a side sheet must also work on a phone, keep `side="right"` or `side="left"` and let the component turn it into a bottom sheet below 640px, instead of switching `side` with a media query, because the component already renders it full width from the bottom, capped at `90svh` and padded above the home indicator (`trap/viewport-height`, `trap/safe-area`). Evidence: person D8; measured `side="right"` at 390px as a full width panel from the bottom, 760px of 844px tall, .design-system/evidence/sheet/open-390-and-1280.json. Check: review of every `side` prop that reads a media query.
  - Don't: `<SheetContent side={isPhone ? "bottom" : "right"}>`
  - Do: `<SheetContent side="right">`
- `rule/sheet-overlay-phone-for-side-editors`: When a sheet edits what sits beside it from 640px up, pass `overlay="phone"`, instead of `overlay={false}` at every width, because the page stays readable where it is visible and dims where the sheet covers it anyway, and an undimmed page under a modal looks live while it is inert. Evidence: measured the phone scrim as `display: none` at 1280px and one inert shell element behind every open sheet, .design-system/evidence/sheet/open-390-and-1280.json; principle heuristic: visibility of system status, the scrim tells the person the page is paused. Check: review of every `overlay={false}`.
  - Don't: `<SheetContent overlay={false}><SheetTitle>Edit details</SheetTitle>...</SheetContent>`
  - Do: `<SheetContent overlay="phone"><SheetTitle>Edit details</SheetTitle>...</SheetContent>`
- `rule/sheet-final-focus-when-the-opener-goes`: When the sheet is opened from a row or an item that its own action removes, pass `finalFocus` on `SheetContent` pointing at the list or the heading that remains, instead of relying on the trigger, because focus returns to the trigger on close and a trigger that is gone drops focus to the page body (`trap/overlay-focus-return`). Evidence: measured focus on the trigger after Escape, .design-system/evidence/sheet/open-390-and-1280.json; principle wcag: 2.4.3 Focus order, focus lands somewhere meaningful after a close. Check: review of every sheet whose action removes its opener.
  - Don't: `<SheetContent><SheetFooter><Button variant="destructive" onClick={removeRow}>Remove</Button></SheetFooter></SheetContent>`
  - Do: `<SheetContent finalFocus={listRef}><SheetFooter><Button variant="destructive" onClick={removeRow}>Remove</Button></SheetFooter></SheetContent>`

### Content
- Follows `rule/writing-dialog-body-sentence`.
- `rule/sheet-title-names-the-task`: When the sheet holds a task, title it with the task's object in sentence case with no end punctuation, such as "Filters" or "Edit details", instead of a sentence or a greeting, because the title is the sheet's accessible name and is read before anything in the body. Evidence: person D11; principle heuristic: consistency and standards, one name from the trigger to the title. Check: lint copy/casing on the dialog-title slot (scripts/copy-check.mjs); review of every `SheetTitle`.
  - Don't: `<SheetTitle>Here you can narrow down your list.</SheetTitle>`
  - Do: `<SheetTitle>Filters</SheetTitle>`

### Anti-slop
- `rule/sheet-no-viewport-height`: When sizing a sheet or its body, leave the height to the component instead of `h-screen`, `100vh` or `h-full` on the content, because `vh` includes the browser bar on a phone, so a footer sized by it sits under the bar, while the component caps the panel at `90svh` (`trap/viewport-height`). Evidence: principle platform: `svh` and `dvh` follow the visible viewport and `vh` does not; measured the panel at 90svh, 760px of 844px, .design-system/evidence/sheet/open-390-and-1280.json. Check: lint trap/viewport-height (scripts/check-system.mjs).
  - Don't: `<SheetContent className="h-screen">`
  - Do: `<SheetContent>`
- `rule/sheet-no-border-edge`: When a sheet needs to read as separate from the page, rely on `shadow-sheet` and the scrim instead of a `border` or a divider under `SheetHeader`, because the shadow and the spacing already do the job and the system draws no borders or header rules. Evidence: person D11. Check: lint rule/component-override on Sheet (scripts/check-system.mjs); review.
  - Don't: `<SheetContent className="border-l"><SheetHeader className="border-b">`
  - Do: `<SheetContent><SheetHeader>`

### Limits
- `rule/sheet-actions-in-the-footer`: When a sheet body holds more than 19 rows, or holds any apply, save or remove action, render the action in `SheetFooter` instead of at the end of the body, because past 19 rows the body scrolls at 390 by 844 and an action at its end leaves the first screen. Evidence: measured the body scrolling at 20 rows of 36px with 534px of body height at 390 by 844, .design-system/evidence/sheet/open-390-and-1280.json. Check: probe `.design-system/scripts/measure-overlays.mjs` grows the body rows on the showcase at 390.
  - Don't: `<SheetBody>{filters.map(...)}<Button>Apply</Button></SheetBody>`
  - Do: `<SheetBody>{filters.map(...)}</SheetBody><SheetFooter><Button>Apply</Button></SheetFooter>`
- `rule/sheet-title-length`: When a title would run past 47 characters, shorten it instead of letting it wrap, because at 48 characters the 16px title wraps to a second line in the 342px column at 390px. Evidence: measured wrap at 48 characters in a 342px column at 390px, .design-system/evidence/sheet/open-390-and-1280.json. Check: probe `.design-system/scripts/measure-overlays.mjs` grows the title on the showcase at 390.
  - Don't: `<SheetTitle>Filters for everything shared with me this month</SheetTitle>`
  - Do: `<SheetTitle>Filters</SheetTitle>`

## Accessibility
Rests on Base UI `Dialog`, which renders `role="dialog"` with `aria-labelledby` and `aria-describedby`, moves focus in on open and back to the trigger on close, and closes on Escape; the team makes the page behind inert through `registry/cobalt/lib/portal.tsx` and gives the scrolling body a tab stop only while it overflows. Every row that says `a11y scan` was read from the open sheet on the live page into `.design-system/evidence/sheet/open-390-and-1280.json`.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Enter or Space | the trigger | opens the sheet | the first tabbable control in the panel | by hand |
| Tab and Shift+Tab | inside the panel | moves between the header, the body's controls, the body itself when it scrolls, the footer and the corner close, and wraps | the next or previous control | by hand |
| Arrow down and up, Page down and up | the body, when it scrolls | scrolls the body; the page behind does not move | the body | by hand |
| Escape | inside the panel | closes the sheet | the trigger (`trap/overlay-focus-return`) | a11y scan |
| Escape | inside a menu or popover open within the sheet | closes the menu or popover only (`trap/escape-nested`) | that menu's trigger | by hand |
| none | the swipe | the swipe has no key of its own: Escape, the corner close and the footer's actions do what it does | the trigger | by hand |
| Enter or Space | a `SheetClose` or the corner close | closes the sheet | the trigger | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| trigger | button | its text, or `aria-label` on an icon trigger | `aria-haspopup="dialog"`, `aria-expanded`, `data-popup-open` while open (`trap/open-trigger-unfocused`) | the name, "button", "collapsed" or "expanded" | test |
| panel | dialog | `aria-labelledby` from `SheetTitle` | `aria-describedby` from `SheetDescription`, `tabindex="-1"`, `data-side`, `data-open` | "dialog", the title, then the description on open | a11y scan |
| body | none | none | `tabindex="0"` only while it overflows | nothing of its own; its controls as focus reaches them | a11y scan |
| corner close | button | the sr-only `closeLabel`, "Close" | none | "Close, button" | by hand |
| scrim | none | none | `data-slot="overlay"`, presentation only | nothing | a11y scan |
| grabber | none, `aria-hidden` | none | `data-slot="sheet-grabber"` | nothing; the corner close is the named way out | by hand |

## Tokens
| Part | State | Token |
|---|---|---|
| panel | all | `--popover`, `--popover-foreground`, `--r-2xl`, `--elev-sheet`, `--t-sheet`, `--curve-sheet`, `--t-leave`, `--t-fade` |
| title | all | `--foreground`, measured 19.8 to 1 on `--popover` in `.design-system/evidence/sheet/open-390-and-1280.json` |
| description | all | `--muted-foreground`, measured 6.01 to 1 on `--popover` |
| corner close | rest | none |
| corner close | hover | `--muted` |
| scrim | all | `--scrim`, `--t-sheet` |
| grabber | all | `--muted-foreground` at 40 percent, fully round |

## Related
- Dialog: a task that fits in one view.
- AlertDialog: a yes or no.
- Nav: the page's navigation, which is not a sheet.
- Popover: one setting beside its trigger, with the page left live.
- Select: a picker that opens in place at every width until a product wraps it in a sheet.
- Crossfade: new content fades in where the old content was.
- Grow: opens one small answer out of the control that asks for it.
- Lightbox: pictures one at a time, as large as the window allows.
- Calendar: a month of days, which DatePicker opens in a sheet on a phone.
