# Sheet / drawer

A controlled modal sheet with side or edge placement, narrow-screen top or bottom reflow, focus trapping and native dismissal contracts.

Access: pro. Category: Feedback. Kind: primitive.

## When to use

- Use it when a product interface needs a controlled modal sheet with side or edge placement, narrow-screen top or bottom reflow, focus trapping and native dismissal contracts.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose dialog instead when use the dialog for a short blocking decision that should hold the center of attention.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Sheet / drawer

```sh
npx shadcn@latest add @tidal-pro/sheet-drawer
```

Stylesheets: `components/ui/tidal.css`, `components/ui/sheet-drawer.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/sheet-drawer.css";
import{TidalSheet}from"./components/ui/sheet-drawer";
export default()=><div className="tidal-scope"><TidalSheet children={"value"} description={"Demo"} onOpenChange={() => {}} open={false} title={"Demo"}/></div>;
```

## Structured props

- `TidalSheet.children: ReactNode`: Required children value accepted by this exported component.
- `TidalSheet.description: ReactNode`: Required description value accepted by this exported component.
- `TidalSheet.onOpenChange: (open: boolean) => void`: Callback invoked when the open change interaction is proposed.
- `TidalSheet.open: boolean`: Required open value accepted by this exported component.
- `TidalSheet.title: ReactNode`: Required title value accepted by this exported component.
- `TidalSheet.closeButtonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "aria-label" | "children"> | undefined`: Optional close button props value accepted by this exported component.
- `TidalSheet.closeButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional close button ref value accepted by this exported component.
- `TidalSheet.closeLabel?: string | undefined` (default "Close panel"): Optional close label value accepted by this exported component.
- `TidalSheet.defaultTriggerLabel?: ReactNode` (default "Open panel"): Optional default trigger label value accepted by this exported component.
- `TidalSheet.defaultTriggerProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> | undefined`: Optional default trigger props value accepted by this exported component.
- `TidalSheet.defaultTriggerRef?: Ref<HTMLButtonElement> | undefined`: Optional default trigger ref value accepted by this exported component.
- `TidalSheet.dir?: "ltr" | "rtl" | undefined`: Optional dir value accepted by this exported component.
- `TidalSheet.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalSheet.headingLevel?: "h2" | "h3" | "h4" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalSheet.mobilePlacement?: TidalSheetMobilePlacement | undefined` (default "bottom"): Optional mobile placement value accepted by this exported component.
- `TidalSheet.overlayProps?: Omit<Omit<Dialog.DialogOverlayProps & RefAttributes<HTMLDivElement>, "ref">, "asChild" | "forceMount"> | undefined`: Optional overlay props value accepted by this exported component.
- `TidalSheet.overlayRef?: Ref<HTMLDivElement> | undefined`: Optional overlay ref value accepted by this exported component.
- `TidalSheet.placement?: TidalSheetPlacement | undefined` (default "right"): Optional placement value accepted by this exported component.
- `TidalSheet.portalContainer?: HTMLElement | null | undefined`: Optional portal container value accepted by this exported component.
- `TidalSheet.theme?: "light" | "dark" | undefined` (default "light"): Optional theme value accepted by this exported component.
- `TidalSheet.trigger?: ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`: Optional trigger value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/sheet-drawer.tsx) | [Manifest](https://tidalui.com/examples/sheet-drawer.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useState } from "react";

import { TidalSheet, type TidalSheetPlacement } from "./components/ui/sheet-drawer";

import "./components/ui/sheet-drawer.css";



const tidalExampleStyles = ".tidal-scope .sheet-demo,\n.tidal-scope .sheet-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .sheet-demo {\n  display: grid;\n  width: min(100%, 980px);\n  min-width: 0;\n  gap: 24px;\n  margin-inline: auto;\n  padding: clamp(16px, 4vw, 42px);\n}\n\n\n.tidal-scope .sheet-demo-status {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n\n.tidal-scope .sheet-demo-status {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.55;\n}\n\n.tidal-scope .sheet-demo-toolbar {\n  display: flex;\n  min-width: 0;\n  align-items: end;\n  justify-content: space-between;\n  gap: 16px;\n  padding: 18px;\n  background: var(--t-subtle);\n  border: 1px solid var(--t-border);\n  border-radius: 18px;\n  flex-wrap: wrap;\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset {\n  display: flex;\n  min-width: 0;\n  gap: 5px;\n  padding: 0;\n  margin: 0;\n  border: 0;\n  flex-wrap: wrap;\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset > legend {\n  width: 100%;\n  margin-bottom: 6px;\n  font-size: 11px;\n  font-weight: 700;\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset label {\n  position: relative;\n  min-width: 0;\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset input {\n  position: absolute;\n  opacity: 0;\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset span {\n  display: inline-flex;\n  min-width: 72px;\n  min-height: 44px;\n  align-items: center;\n  justify-content: center;\n  padding: 8px 10px;\n  color: var(--t-muted);\n  background: var(--t-surface);\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  font-size: 11px;\n  font-weight: 680;\n  text-transform: capitalize;\n  cursor: pointer;\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset input:checked + span {\n  color: var(--t-surface);\n  background: var(--t-ink);\n  border-color: var(--t-ink);\n}\n\n.tidal-scope .sheet-demo-toolbar > fieldset input:focus-visible + span {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n.tidal-scope .sheet-demo-fields {\n  display: grid;\n  gap: 18px;\n}\n\n.tidal-scope .sheet-demo-fields fieldset {\n  display: grid;\n  gap: 8px;\n  padding: 0;\n  margin: 0;\n  border: 0;\n}\n\n.tidal-scope .sheet-demo-fields legend {\n  margin-bottom: 3px;\n  font-size: 11px;\n  font-weight: 700;\n}\n\n.tidal-scope .sheet-demo-fields fieldset label,\n.tidal-scope .sheet-demo-check {\n  display: flex;\n  min-width: 0;\n  min-height: 54px;\n  align-items: center;\n  gap: 10px;\n  padding: 10px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  cursor: pointer;\n}\n\n.tidal-scope .sheet-demo-fields input {\n  width: 20px;\n  height: 20px;\n  flex: none;\n  accent-color: var(--t-ink);\n}\n\n.tidal-scope .sheet-demo-fields label > span {\n  display: grid;\n  min-width: 0;\n  gap: 2px;\n}\n\n.tidal-scope .sheet-demo-fields label :is(strong, small) {\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .sheet-demo-fields label strong {\n  font-size: 11px;\n}\n\n.tidal-scope .sheet-demo-fields label small {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.45;\n}\n\n.tidal-scope .sheet-demo-fields dl {\n  display: grid;\n  gap: 1px;\n  margin: 0;\n  overflow: hidden;\n  background: var(--t-border);\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n}\n\n.tidal-scope .sheet-demo-fields dl > div {\n  display: flex;\n  min-width: 0;\n  justify-content: space-between;\n  gap: 14px;\n  padding: 11px;\n  background: var(--t-surface);\n}\n\n.tidal-scope .sheet-demo-fields :is(dt, dd) {\n  min-width: 0;\n  margin: 0;\n  font-size: 11px;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .sheet-demo-fields dt {\n  color: var(--t-muted);\n}\n\n.tidal-scope .sheet-demo-actions {\n  display: flex;\n  min-width: 0;\n  justify-content: flex-end;\n  gap: 8px;\n  flex-wrap: wrap;\n}\n\n.tidal-scope .sheet-demo-actions button {\n  min-width: 116px;\n  min-height: 44px;\n  padding: 8px 12px;\n  color: var(--t-ink);\n  background: var(--t-surface);\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  font: inherit;\n  font-size: 11px;\n  font-weight: 680;\n}\n\n.tidal-scope .sheet-demo-actions button:last-child {\n  color: var(--t-surface);\n  background: var(--t-ink);\n  border-color: var(--t-ink);\n}\n\n@media (max-width: 390px) {\n  .tidal-scope .sheet-demo {\n    padding: 12px;\n  }\n\n  .tidal-scope .sheet-demo-toolbar > fieldset {\n    display: grid;\n    width: 100%;\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n  }\n\n  .tidal-scope .sheet-demo-toolbar > fieldset > legend {\n    grid-column: 1 / -1;\n  }\n\n  .tidal-scope .sheet-demo-toolbar > fieldset span,\n  .tidal-scope .sheet-demo-actions button {\n    width: 100%;\n  }\n\n  .tidal-scope .sheet-demo-actions {\n    display: grid;\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n    width: 100%;\n  }\n  .tidal-scope .sheet-demo-actions button {\n    min-width: 0;\n  }\n}\n\n@media (hover: none) and (pointer: coarse) {\n  .tidal-scope .sheet-demo-toolbar > fieldset span,\n  .tidal-scope .sheet-demo-actions button {\n    font-size: 16px;\n  }\n}";

export function SheetDrawerDemo({
  theme = "light",
}: {
  theme?: "light" | "dark";
}) {
  const generatedId = useId().replace(/:/g, "");
  const [open, setOpen] = useState(false);
  const [placement, setPlacement] = useState<TidalSheetPlacement>("right");
  const [density, setDensity] = useState("comfortable");
  const [draftDensity, setDraftDensity] = useState("comfortable");
  const [showHints, setShowHints] = useState(true);
  const [draftShowHints, setDraftShowHints] = useState(true);
  const [status, setStatus] = useState("Choose a placement and open settings.");

  return (
    <section className="sheet-demo" aria-label="Sheet preview">
      <div className="sheet-demo-toolbar">
        <fieldset>
          <legend>Desktop placement</legend>
          {(["left", "right", "top", "bottom"] as const).map((value) => (
            <label key={value}>
              <input
                type="radio"
                name={`sheet-placement-${generatedId}`}
                value={value}
                checked={placement === value}
                onChange={() => setPlacement(value)}
              />
              <span>{value}</span>
            </label>
          ))}
        </fieldset>

        <TidalSheet
          theme={theme}
          open={open}
          onOpenChange={(nextOpen) => {
            if (nextOpen) {
              setDraftDensity(density);
              setDraftShowHints(showHints);
            }
            setOpen(nextOpen);
          }}
          title="View settings"
          description="Choose how your workspace appears."
          placement={placement}
          mobilePlacement="bottom"
          defaultTriggerLabel="Open settings"
          onEscapeKeyDown={() => setStatus("Settings closed.")}
          onPointerDownOutside={() => setStatus("Settings closed.")}
          footer={
            <div className="sheet-demo-actions">
              <button type="button" onClick={() => setOpen(false)}>
                Cancel
              </button>
              <button
                type="button"
                onClick={() => {
                  setDensity(draftDensity);
                  setShowHints(draftShowHints);
                  setStatus(
                    `${draftDensity === "compact" ? "Compact" : "Comfortable"} view applied.`,
                  );
                  setOpen(false);
                }}
              >
                Apply changes
              </button>
            </div>
          }
        >
          <div className="sheet-demo-fields">
            <fieldset>
              <legend>Row density</legend>
              <label>
                <input
                  type="radio"
                  name={`sheet-density-${generatedId}`}
                  value="comfortable"
                  checked={draftDensity === "comfortable"}
                  onChange={() => setDraftDensity("comfortable")}
                />
                <span>
                  <strong>Comfortable</strong>
                  <small>More space around each row.</small>
                </span>
              </label>
              <label>
                <input
                  type="radio"
                  name={`sheet-density-${generatedId}`}
                  value="compact"
                  checked={draftDensity === "compact"}
                  onChange={() => setDraftDensity("compact")}
                />
                <span>
                  <strong>Compact</strong>
                  <small>Fit more rows on screen.</small>
                </span>
              </label>
            </fieldset>

            <label className="sheet-demo-check">
              <input
                type="checkbox"
                checked={draftShowHints}
                onChange={(event) =>
                  setDraftShowHints(event.currentTarget.checked)
                }
              />
              <span>
                <strong>Show hints</strong>
                <small>Show helpful labels beside controls.</small>
              </span>
            </label>

            <dl>
              <div>
                <dt>Density</dt>
                <dd>{draftDensity}</dd>
              </div>
              <div>
                <dt>Hints</dt>
                <dd>{draftShowHints ? "Shown" : "Hidden"}</dd>
              </div>
            </dl>
          </div>
        </TidalSheet>
      </div>

      <p className="sheet-demo-status" role="status" aria-live="polite">
        {status} Sample data. Changes stay in this preview.
      </p>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SheetDrawerDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Escape dismisses the open overlay where the underlying primitive supports dismissal."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

open, onOpenChange, title, description and children are required. Radix Dialog provides modal focus trapping, initial focus, Escape and backdrop dismissal, outside-interaction prevention and focus return. Optional placement left/right/top/bottom and mobilePlacement top/bottom/same control edge geometry; the default right sheet becomes bottom below 650px. Optional single native focusable trigger or native default trigger props/ref, semantic heading level, footer, native close props/ref and label, overlay props/ref, portal container, theme, direction and native Dialog.Content attributes/ref remain consumer-owned. Default trigger and close native disabled or aria-disabled true resolve disabled behavior; explicit false is preserved. Content event callbacks may prevent Escape, pointer-outside, interaction-outside, open autofocus or close autofocus behavior. The body is the only scroll region. The component performs no navigation, form submission, save, request, account, storage or application-state effect.
