# Drawer

A panel that slides in from an edge of the screen and can be swiped away.

A sheet that slides in from an edge over a dimmed page: from the bottom on a phone (with a grabber), from the end or the start for a side panel. It follows the finger: drag it towards its edge to dismiss it, release short of a quarter and it settles back. Otherwise it is the Dialog: title, description, body and actions, focus trapped inside, Escape closes, focus returns to the trigger, the page behind is inert and does not scroll. Behaviour comes from the Zag drawer machine through Ark UI.

Kind: component · Category: Overlays · Status: beta · Targets: React, Vue, Svelte · Behaviour: Zag `drawer` machine, through Ark UI

## Add

```bash
npx fndn add drawer
```

It writes the folder `drawer/` into the project's ui folder (`index.ts`, `drawer.tsx`, `Drawer.vue`, `Drawer.svelte`, `drawer.recipe.ts`), and what it is built from: [Button](/components/button.md), [Tooltip](/components/tooltip.md), [Dialog](/components/dialog.md). First time: [Installation](/installation.md).

## Usage

```tsx
import { Drawer } from "@/components/ui/drawer";
```

```vue
import { Drawer } from "@/components/ui/drawer";
```

```svelte
import { Drawer } from "$lib/components/ui/drawer";
```

## Parts

In the DOM the root carries `data-slot="drawer"` and each part `data-slot="drawer-<part>"`; in the recipe the root is the `base` slot and each part a slot named after it in camelCase.

| Part | Element | data-slot | Flags | Notes |
| --- | --- | --- | --- | --- |
| `root` | `div` | `drawer` |  | Layout-neutral hook around the trigger (display: contents). |
| `trigger` | `button` | `drawer-trigger` |  | aria-haspopup=dialog, aria-expanded. The default trigger is the real Button (outline, sm), marked data-drawer="trigger". |
| `backdrop` | `div` | `drawer-backdrop` |  | Dims the page with color.scrim; rendered in a portal. While the sheet is dragged it fades with the drag (1 − --drawer-swipe-progress). |
| `positioner` | `div` | `drawer-positioner` |  | Fixed over the viewport, rendered in a portal; places the sheet against its edge. A press on it (outside the sheet) closes. |
| `content` | `div` | `drawer-content` |  | role=dialog, aria-modal; data-state=open\|closed, data-swipe-direction, data-dragging. Surface, shadow.overlay, radius.window on the corners away from its edge. bottom: full width up to 640px, centred, at most the viewport less 48px high, scrolls inside. end / start: full height, 400px wide (at most the viewport less 48px). Carries kbd-instant. The engine's inline transform holds the drag offset; the slide itself is the translate property, so the two never fight. |
| `grabber` | `div` | `drawer-grabber` | optional | bottom only: a strip along the top edge (8px above the handle) that starts a drag (touch-action: none), holding the indicator. aria-hidden. The whole sheet can be dragged too; the grabber is the visible cue. |
| `grabber-indicator` | `div` | `drawer-grabber-indicator` | optional | The visible handle: 36×4px pill in color.line-strong, centred in the grabber. |
| `header` | `div` | `drawer-header` |  | The Dialog's header: title and close button on one line. |
| `title` | `h2` | `drawer-title` |  | text.md, weight 600 (the Dialog's title). |
| `close` | `button` | `drawer-close` | optional | The Dialog's close button: a Button (ghost, sm, square, rounded, muted) with a Tooltip, aria-label=Close. Marked data-drawer="close". |
| `description` | `div` | `drawer-description` | optional | text.sm, ink-2 (the Dialog's description). |
| `body` | `div` | `drawer-body` | optional | The default slot: takes the free height and scrolls inside the sheet (overscroll contained). |
| `footer` | `div` | `drawer-footer` | optional | Actions as Buttons (sm), at the end of the row; on a phone they share the row, as in the Dialog. Sits above the safe-area inset. |

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | `false` | Bindable (React: `defaultOpen` and `onOpenChange`; Vue: `v-model:open`; Svelte: `bind:open`). Controlled: open with onOpenChange. Uncontrolled: defaultOpen. |
| `side` | `"bottom" \| "end" \| "start"` | `"bottom"` | The edge it slides from, and towards which a drag dismisses it. end and start follow the writing direction. |
| `title` | `string` |  | Required: it names the sheet. |
| `description` | `string` |  |  |
| `actions` | `{ label: string; value?: string; variant?: button variant; close?: boolean }[]` |  | Footer Buttons in order, least destructive first. Each closes the sheet unless close is false. |
| `closable` | `boolean` | `true` | Show the close button in the header. |
| `triggerLabel` | `string` |  | Renders a default Button trigger with this label. Otherwise pass your own trigger, or control `open`. |

Other attributes and `class` go to the root; `class` is merged through the recipe.

## Events

| Event | Payload |
| --- | --- |
| `openChange` | (open: boolean) after a trigger press, Escape, a press outside, a dismissing drag, an action |
| `action` | (value: string) when a footer action is pressed |

## Slots

| Slot | Content |
| --- | --- |
| `default` | Body content |
| `trigger` | Your own trigger element (React: the trigger prop; Vue: trigger slot; Svelte: trigger snippet receiving the props to spread) |
| `footer` | Custom footer instead of `actions` |

## States

`open`, `dragging`, `hover`, `press`, `focus-visible`

## Keyboard and accessibility

Role: dialog.

Keyboard:

- Enter / Space on the trigger open it; focus moves to the first control in the sheet
- Tab and Shift+Tab cycle inside the sheet; focus cannot leave it
- Escape closes and returns focus to the trigger
- A press outside the sheet closes it; focus returns to the trigger

Notes:

- Labelled by its title and described by its description; aria-modal.
- While open the rest of the page is inert and does not scroll.
- Dragging is an extra way to close, never the only one: the close button, Escape and a press outside always work. The grabber is decorative (aria-hidden).
- Opening and closing from the keyboard are instant.

## Motion

- open from the pointer: the sheet slides in from its edge (translate motion.sheet-shift, 100% → 0) over duration.slow with easing.drawer; the backdrop fades in with it
- close: it slides back out, shorter, over duration.base with easing.drawer; the backdrop fades over the same time
- drag: the sheet follows the finger 1:1 with no transition (the engine zeroes it while dragging) and the backdrop fades with the drag; on release it settles back, or leaves from where it is, over duration.slow with easing.drawer
- keyboard: open and close are instant (kbd-instant)
- reduced motion: no travel (motion.sheet-shift is 0%): the sheet fades in over duration.slow and out over duration.base, the backdrop with it
- mounted open (defaultOpen, or open at mount): sheet and backdrop are drawn at once, with no entrance (data-mounted-open until it first closes); its close, and every later open, animate as above

## Tokens

`color.scrim`, `color.surface`, `color.ink`, `color.ink-2`, `color.line-strong`, `shadow.overlay`, `radius.window`, `radius.pill`, `text.sm`, `text.md`, `duration.base`, `duration.slow`, `easing.drawer`, `motion.sheet-shift`, `z.dialog`

## Dependencies

- [Button](/components/button.md)
- [Tooltip](/components/tooltip.md)
- [Dialog](/components/dialog.md)

## Examples

### Edit deploy settings

React · `deploy-settings.tsx`

```tsx
import { useState } from "react";
import { Drawer, type DrawerAction } from "@/components/ui/drawer";
import { Field } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";

const actions: DrawerAction[] = [
  { label: "Cancel", value: "cancel", variant: "ghost" },
  { label: "Save changes", value: "save", variant: "primary" },
];

/* a side panel keeps the page in view while you edit what is on it */
export default function DeploySettings() {
  const [branch, setBranch] = useState("main");
  const [buildCommand, setBuildCommand] = useState("pnpm build");
  const [deployOnPush, setDeployOnPush] = useState(true);
  return (
    <div className="flex w-80 items-center justify-between gap-3">
      <div className="flex min-w-0 flex-col">
        <span className="text-sm font-medium text-ink">Production</span>
        <span className="text-xs text-ink-2">Deploys main on every push</span>
      </div>
      <Drawer
        side="end"
        triggerLabel="Edit deploy settings"
        title="Deploy settings"
        description="web-app · Production"
        actions={actions}
      >
        <div className="flex flex-col gap-4">
          <Field label="Production branch">
            <Input value={branch} onChange={(event) => setBranch(event.target.value)} mono />
          </Field>
          <Field label="Build command" helper="Runs in the repository root.">
            <Input value={buildCommand} onChange={(event) => setBuildCommand(event.target.value)} mono />
          </Field>
          <Switch checked={deployOnPush} onCheckedChange={setDeployOnPush}>Deploy every push to main</Switch>
        </div>
      </Drawer>
    </div>
  );
}
```

Vue · `deploy-settings.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { Drawer, type DrawerAction } from "@/components/ui/drawer";
import { Field } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";

const actions: DrawerAction[] = [
  { label: "Cancel", value: "cancel", variant: "ghost" },
  { label: "Save changes", value: "save", variant: "primary" },
];

const branch = ref("main");
const buildCommand = ref("pnpm build");
const deployOnPush = ref(true);
</script>

<!-- a side panel keeps the page in view while you edit what is on it -->
<template>
  <div class="flex w-80 items-center justify-between gap-3">
    <div class="flex min-w-0 flex-col">
      <span class="text-sm font-medium text-ink">Production</span>
      <span class="text-xs text-ink-2">Deploys main on every push</span>
    </div>
    <Drawer
      side="end"
      triggerLabel="Edit deploy settings"
      title="Deploy settings"
      description="web-app · Production"
      :actions="actions"
    >
      <div class="flex flex-col gap-4">
        <Field label="Production branch">
          <Input v-model="branch" mono />
        </Field>
        <Field label="Build command" helper="Runs in the repository root.">
          <Input v-model="buildCommand" mono />
        </Field>
        <Switch v-model:checked="deployOnPush">Deploy every push to main</Switch>
      </div>
    </Drawer>
  </div>
</template>
```

Svelte · `deploy-settings.svelte`

```svelte
<script lang="ts">
  import { Drawer, type DrawerAction } from "$lib/components/ui/drawer";
  import { Field } from "$lib/components/ui/field";
  import { Input } from "$lib/components/ui/input";
  import { Switch } from "$lib/components/ui/switch";

  const actions: DrawerAction[] = [
    { label: "Cancel", value: "cancel", variant: "ghost" },
    { label: "Save changes", value: "save", variant: "primary" },
  ];

  let branch = $state("main");
  let buildCommand = $state("pnpm build");
  let deployOnPush = $state(true);
</script>

<!-- a side panel keeps the page in view while you edit what is on it -->
<div class="flex w-80 items-center justify-between gap-3">
  <div class="flex min-w-0 flex-col">
    <span class="text-sm font-medium text-ink">Production</span>
    <span class="text-xs text-ink-2">Deploys main on every push</span>
  </div>
  <Drawer
    side="end"
    triggerLabel="Edit deploy settings"
    title="Deploy settings"
    description="web-app · Production"
    {actions}
  >
    <div class="flex flex-col gap-4">
      <Field label="Production branch">
        <Input bind:value={branch} mono />
      </Field>
      <Field label="Build command" helper="Runs in the repository root.">
        <Input bind:value={buildCommand} mono />
      </Field>
      <Switch bind:checked={deployOnPush}>Deploy every push to main</Switch>
    </div>
  </Drawer>
</div>
```

### Filters as a bottom sheet on a phone

React · `filter-sheet.tsx`

```tsx
import { useState } from "react";
import { Drawer, type DrawerAction } from "@/components/ui/drawer";
import { Select } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";

const allEnvironments = "All environments";
const anyStatus = "Any status";
const environments = [allEnvironments, "Production", "Staging", "Preview"];
const statuses = [anyStatus, "Ready", "Building", "Failed"];

const actions: DrawerAction[] = [
  { label: "Reset", value: "reset", variant: "ghost", close: false },
  { label: "Show 24 deploys", value: "apply", variant: "primary" },
];

/* on a phone, filters come up from the bottom; Reset keeps the sheet open */
export default function FilterSheet() {
  const [environment, setEnvironment] = useState("Production");
  const [status, setStatus] = useState(anyStatus);
  const [mine, setMine] = useState(false);
  const reset = (value: string) => {
    if (value !== "reset") return;
    setEnvironment(allEnvironments);
    setStatus(anyStatus);
    setMine(false);
  };
  return (
    <div className="flex w-80 items-center justify-between gap-3">
      <div className="flex min-w-0 flex-col">
        <span className="text-sm font-medium text-ink">Deploys</span>
        <span className="text-xs text-ink-2">Production · last 7 days</span>
      </div>
      <Drawer side="bottom" triggerLabel="Filters" title="Filter deploys" actions={actions} onAction={reset}>
        <div className="flex flex-col gap-4">
          <Select label="Environment" items={environments} value={environment} onValueChange={(value) => setEnvironment(value ?? allEnvironments)} />
          <Select label="Status" items={statuses} value={status} onValueChange={(value) => setStatus(value ?? anyStatus)} />
          <Switch checked={mine} onCheckedChange={setMine}>Only deploys I started</Switch>
        </div>
      </Drawer>
    </div>
  );
}
```

Vue · `filter-sheet.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { Drawer, type DrawerAction } from "@/components/ui/drawer";
import { Select } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";

const allEnvironments = "All environments";
const anyStatus = "Any status";
const environments = [allEnvironments, "Production", "Staging", "Preview"];
const statuses = [anyStatus, "Ready", "Building", "Failed"];

const actions: DrawerAction[] = [
  { label: "Reset", value: "reset", variant: "ghost", close: false },
  { label: "Show 24 deploys", value: "apply", variant: "primary" },
];

/* on a phone, filters come up from the bottom; Reset keeps the sheet open */
const environment = ref("Production");
const status = ref(anyStatus);
const mine = ref(false);
function reset(value: string) {
  if (value !== "reset") return;
  environment.value = allEnvironments;
  status.value = anyStatus;
  mine.value = false;
}
</script>

<template>
  <div class="flex w-80 items-center justify-between gap-3">
    <div class="flex min-w-0 flex-col">
      <span class="text-sm font-medium text-ink">Deploys</span>
      <span class="text-xs text-ink-2">Production · last 7 days</span>
    </div>
    <Drawer side="bottom" triggerLabel="Filters" title="Filter deploys" :actions="actions" @action="reset">
      <div class="flex flex-col gap-4">
        <Select v-model:value="environment" label="Environment" :items="environments" />
        <Select v-model:value="status" label="Status" :items="statuses" />
        <Switch v-model:checked="mine">Only deploys I started</Switch>
      </div>
    </Drawer>
  </div>
</template>
```

Svelte · `filter-sheet.svelte`

```svelte
<script lang="ts">
  import { Drawer, type DrawerAction } from "$lib/components/ui/drawer";
  import { Select } from "$lib/components/ui/select";
  import { Switch } from "$lib/components/ui/switch";

  const allEnvironments = "All environments";
  const anyStatus = "Any status";
  const environments = [allEnvironments, "Production", "Staging", "Preview"];
  const statuses = [anyStatus, "Ready", "Building", "Failed"];

  const actions: DrawerAction[] = [
    { label: "Reset", value: "reset", variant: "ghost", close: false },
    { label: "Show 24 deploys", value: "apply", variant: "primary" },
  ];

  /* on a phone, filters come up from the bottom; Reset keeps the sheet open */
  let environment = $state("Production");
  let status = $state(anyStatus);
  let mine = $state(false);
  function reset(value: string) {
    if (value !== "reset") return;
    environment = allEnvironments;
    status = anyStatus;
    mine = false;
  }
</script>

<div class="flex w-80 items-center justify-between gap-3">
  <div class="flex min-w-0 flex-col">
    <span class="text-sm font-medium text-ink">Deploys</span>
    <span class="text-xs text-ink-2">Production · last 7 days</span>
  </div>
  <Drawer side="bottom" triggerLabel="Filters" title="Filter deploys" {actions} onaction={reset}>
    <div class="flex flex-col gap-4">
      <Select bind:value={environment} label="Environment" items={environments} />
      <Select bind:value={status} label="Status" items={statuses} />
      <Switch bind:checked={mine}>Only deploys I started</Switch>
    </div>
  </Drawer>
</div>
```

### Member details from a list

React · `member-panel.tsx`

```tsx
import { useState } from "react";
import { Avatar } from "@/components/ui/avatar";
import { Drawer } from "@/components/ui/drawer";
import { TextRow } from "@/components/ui/text-row";

const members = [
  { name: "Maya Chen", email: "maya@northwind.example", role: "Owner", lastActive: "Now" },
  { name: "Daniel Okafor", email: "daniel@northwind.example", role: "Admin", lastActive: "2 hours ago" },
  { name: "Sofia Alvarez", email: "sofia@northwind.example", role: "Viewer", lastActive: "Nov 12, 2026" },
] as const;

/* one drawer for the whole list: a row sets the member and opens it (open is controlled) */
export default function MemberPanel() {
  const [open, setOpen] = useState(false);
  const [member, setMember] = useState<(typeof members)[number]>(members[0]);
  return (
    <>
      <ul className="flex w-80 flex-col">
        {members.map((m) => (
          <li key={m.email}>
            <button
              type="button"
              className="flex w-full items-center gap-3 rounded-control px-2 py-1.5 text-start hover:bg-hover"
              onClick={() => { setMember(m); setOpen(true); }}
            >
              <Avatar name={m.name} size={20} />
              <span className="flex-1 text-sm font-medium text-ink">{m.name}</span>
              <span className="text-xs text-ink-2">{m.role}</span>
            </button>
          </li>
        ))}
      </ul>
      <Drawer open={open} onOpenChange={setOpen} side="end" title={member.name} description={member.email}>
        <TextRow label="Role" value={member.role} />
        <TextRow label="Last active" value={member.lastActive} />
        <TextRow label="Projects" value="web-app, billing-api" />
      </Drawer>
    </>
  );
}
```

Vue · `member-panel.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { Avatar } from "@/components/ui/avatar";
import { Drawer } from "@/components/ui/drawer";
import { TextRow } from "@/components/ui/text-row";

const members = [
  { name: "Maya Chen", email: "maya@northwind.example", role: "Owner", lastActive: "Now" },
  { name: "Daniel Okafor", email: "daniel@northwind.example", role: "Admin", lastActive: "2 hours ago" },
  { name: "Sofia Alvarez", email: "sofia@northwind.example", role: "Viewer", lastActive: "Nov 12, 2026" },
] as const;

/* one drawer for the whole list: a row sets the member and opens it (open is controlled) */
const open = ref(false);
const member = ref<(typeof members)[number]>(members[0]);
function show(m: (typeof members)[number]) {
  member.value = m;
  open.value = true;
}
</script>

<template>
  <ul class="flex w-80 flex-col">
    <li v-for="m in members" :key="m.email">
      <button
        type="button"
        class="flex w-full items-center gap-3 rounded-control px-2 py-1.5 text-start hover:bg-hover"
        @click="show(m)"
      >
        <Avatar :name="m.name" :size="20" />
        <span class="flex-1 text-sm font-medium text-ink">{{ m.name }}</span>
        <span class="text-xs text-ink-2">{{ m.role }}</span>
      </button>
    </li>
  </ul>
  <Drawer v-model:open="open" side="end" :title="member.name" :description="member.email">
    <TextRow label="Role" :value="member.role" />
    <TextRow label="Last active" :value="member.lastActive" />
    <TextRow label="Projects" value="web-app, billing-api" />
  </Drawer>
</template>
```

Svelte · `member-panel.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";
  import { Drawer } from "$lib/components/ui/drawer";
  import { TextRow } from "$lib/components/ui/text-row";

  const members = [
    { name: "Maya Chen", email: "maya@northwind.example", role: "Owner", lastActive: "Now" },
    { name: "Daniel Okafor", email: "daniel@northwind.example", role: "Admin", lastActive: "2 hours ago" },
    { name: "Sofia Alvarez", email: "sofia@northwind.example", role: "Viewer", lastActive: "Nov 12, 2026" },
  ] as const;

  /* one drawer for the whole list: a row sets the member and opens it (open is controlled) */
  let open = $state(false);
  let member = $state<(typeof members)[number]>(members[0]);
  function show(m: (typeof members)[number]) {
    member = m;
    open = true;
  }
</script>

<ul class="flex w-80 flex-col">
  {#each members as m (m.email)}
    <li>
      <button
        type="button"
        class="flex w-full items-center gap-3 rounded-control px-2 py-1.5 text-start hover:bg-hover"
        onclick={() => show(m)}
      >
        <Avatar name={m.name} size={20} />
        <span class="flex-1 text-sm font-medium text-ink">{m.name}</span>
        <span class="text-xs text-ink-2">{m.role}</span>
      </button>
    </li>
  {/each}
</ul>
<Drawer bind:open side="end" title={member.name} description={member.email}>
  <TextRow label="Role" value={member.role} />
  <TextRow label="Last active" value={member.lastActive} />
  <TextRow label="Projects" value="web-app, billing-api" />
</Drawer>
```

## Recipe

`drawer.recipe.ts`:

```ts
import { tv, type VariantProps } from "../lib/tv";
import { dialog } from "../dialog/dialog.recipe";

/* drawer — a sheet that slides in from an edge (Zag drawer machine: focus trap, Escape, scroll
 * lock, inert page, drag to dismiss). The header, title, close button, description and footer
 * are the Dialog's (the dialog recipe's slots, composed below), so a sheet and a window read as
 * one family; the trigger and the close button are Buttons, marked data-drawer="trigger|close".
 *
 * Motion. The engine writes the drag offset as an inline transform (translate3d of
 * --drawer-translate-x/y) and zeroes the transition while a finger holds the sheet, so the sheet
 * follows it 1:1. The slide in and out is the separate `translate` property, which composes with
 * that transform instead of fighting it: motion.sheet-shift (100%) of the sheet towards its edge when closed and on
 * the first frame (@starting-style), none when open. In over duration.slow, out over
 * duration.base (shorter), both on easing.drawer; a released drag settles from where it is on the
 * same curve. `hidden` flips display, so display transitions as a discrete property and the sheet
 * stays painted while it leaves. From the keyboard everything is instant (kbd-instant). A sheet
 * already open when it mounts is drawn at once: the adapter marks backdrop and sheet
 * data-mounted-open until it first closes, and the first-frame styles skip them.
 * Stacking: positioner and backdrop take theirs from base.css (see the report: a drawer should
 * sit on the dialog layer). */

const d = dialog();

const IN = "motion-also-[transform_var(--fndn-duration-slow)_var(--fndn-easing-drawer),translate_var(--fndn-duration-slow)_var(--fndn-easing-drawer),display_var(--fndn-duration-slow)_allow-discrete]";
const OUT = "data-[state=closed]:motion-also-[transform_var(--fndn-duration-base)_var(--fndn-easing-drawer),translate_var(--fndn-duration-base)_var(--fndn-easing-drawer),display_var(--fndn-duration-base)_allow-discrete]";

export const drawer = tv({
  slots: {
    base: "contents",
    trigger: "shrink-0",
    backdrop: [
      "kbd-instant",
      "fixed inset-0 bg-scrim [opacity:calc(1-var(--drawer-swipe-progress,0))]",
      "motion-opacity-slow-out motion-also-[display_var(--fndn-duration-slow)_allow-discrete]",
      "starting:data-[state=open]:not-data-mounted-open:opacity-0",
      "data-[state=closed]:opacity-0",
      "data-[state=closed]:motion-opacity-base-out data-[state=closed]:motion-also-[display_var(--fndn-duration-base)_allow-discrete]",
      /* while a finger holds the sheet the dimming follows it, with no lag */
      "data-swiping:data-[state=open]:transition-none!",
    ],
    positioner: [
      "kbd-instant",
      "fixed inset-0 flex pointer-events-auto",
      "motion-also-[display_var(--fndn-duration-base)_allow-discrete]",
    ],
    content: [
      "kbd-instant",
      "relative flex flex-col min-h-0 bg-surface text-ink shadow-overlay outline-none overflow-hidden",
      "[translate:none]",
      /* reduced motion: motion.sheet-shift is 0%, so the sheet does not travel; it fades instead */
      "motion-reduce:data-[state=closed]:opacity-0 motion-reduce:starting:data-[state=open]:not-data-mounted-open:opacity-0",
      "motion-reduce:motion-opacity-slow-out motion-reduce:data-[state=closed]:motion-opacity-base-out",
      IN,
      OUT,
      /* a sheet dismissed by a drag leaves from where the finger let go: the engine keeps its inline
       * transition-duration of 0s until the exit is over, so a pointer exit restores the timing */
      "[:root:not([data-fndn-input=keyboard])_&]:data-[state=closed]:[transition-duration:var(--fndn-duration-base)]!",
    ],
    grabber: "flex shrink-0 justify-center pt-2 cursor-grab active:cursor-grabbing",
    grabberIndicator: "h-1 w-9 rounded-pill bg-line-strong",
    header: [d.header(), "[[data-slot=drawer-grabber]+&]:pt-3"],
    title: d.title(),
    close: d.close(),
    description: d.description(),
    body: [d.body(), "flex-1 min-h-0 overflow-y-auto overscroll-contain"],
    footer: d.footer(),
  },
  variants: {
    side: {
      bottom: {
        positioner: "items-end justify-center pt-12",
        content: [
          "w-full max-w-[640px] max-h-full rounded-t-window",
          "data-[state=closed]:translate-y-(--fndn-motion-sheet-shift) starting:data-[state=open]:not-data-mounted-open:translate-y-(--fndn-motion-sheet-shift)",
        ],
        footer: "pb-[calc(16px+env(safe-area-inset-bottom,0px))]",
      },
      end: {
        positioner: "items-stretch justify-end",
        content: [
          "h-full w-[min(400px,calc(100vw-48px))] rounded-s-window",
          "ltr:data-[state=closed]:translate-x-(--fndn-motion-sheet-shift) ltr:starting:data-[state=open]:not-data-mounted-open:translate-x-(--fndn-motion-sheet-shift)",
          "rtl:data-[state=closed]:-translate-x-(--fndn-motion-sheet-shift) rtl:starting:data-[state=open]:not-data-mounted-open:-translate-x-(--fndn-motion-sheet-shift)",
        ],
      },
      start: {
        positioner: "items-stretch justify-start",
        content: [
          "h-full w-[min(400px,calc(100vw-48px))] rounded-e-window",
          "ltr:data-[state=closed]:-translate-x-(--fndn-motion-sheet-shift) ltr:starting:data-[state=open]:not-data-mounted-open:-translate-x-(--fndn-motion-sheet-shift)",
          "rtl:data-[state=closed]:translate-x-(--fndn-motion-sheet-shift) rtl:starting:data-[state=open]:not-data-mounted-open:translate-x-(--fndn-motion-sheet-shift)",
        ],
      },
    },
  },
  defaultVariants: { side: "bottom" },
});

export type DrawerRecipeProps = VariantProps<typeof drawer>;
```
