# Sheet

> A panel from the bottom of a phone screen for menus, filters and short tasks.

Source: https://kwark.space/designSystem/components/sheet

## Usage

On phones every menu is a sheet. A sheet that leads somewhere drills down **one page at a time** with a back row at the top, instead of stacking a second sheet. Provide a visible Close, Escape and backdrop dismissal. Add swipe dismissal only when it preserves inner scrolling and typed work.

## Style

### Anatomy

1. **Panel**: full width up to 560px, at most 88dvh, 14px top corners, 1px `--k-line` without a bottom edge, `--k-surface`; 8px 16px padding plus the safe area (`.k-sheet`).
2. **Grab**: 36 × 4px in `--k-line`, centred, decorative.
3. **Title**: Raleway 600 16px; an optional 12px meta line (*Blank Pages*).
4. **Rows** (`MenuSheet`): 44px, a 24px icon column, Poppins 500 14px, an optional 12px hint line (56px row), a 14px chevron where a row opens another page, a tick in the light accent for the current choice.
5. **Back**: a text button with the previous page’s name (*‹ Menu*), never a second sheet.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-surface` | #ffffff | #1a1a1a |
| `--k-radius-sheet` | 14px |  |
| `--k-line` | #e2e8f0 | rgba(255, 255, 255, .1) |

## Code

### React

In the Kwark app: `import { MenuSheet } from '@/components/ui/MenuSheet'`.

```tsx
<MenuSheet open={open} onClose={close} title="Characters" meta={project.name}
  items={[{ label: 'New character', icon: Plus, onSelect: add }, { label: 'Sort by', icon: Users, hint: 'Story order', page: sortItems }]} />
```

| Prop | Type | Notes |
|---|---|---|
| `title` | `string` | the menu’s own name |
| `meta` | `string` | a quiet line under the title |
| `items` | `MenuSheetItem[]` | { group } | { label, icon?, hint?, checked?, disabled?, danger?, onSelect?, opens?, page? } |
| `container` | `HTMLElement` | draw inside a themed room |

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<div data-modal-example><button class="kw-button" type="button" data-open-example>Open the Characters menu</button>
<dialog class="kw-sheet" aria-labelledby="sheet-title" style="margin:auto auto 0;padding-top:8px">
  <span class="kw-sheet__grip" aria-hidden="true"></span>
  <h2 class="kw-sheet__title" id="sheet-title">Characters</h2>
  <p class="kw-sheet__meta">Blank Pages</p>
  <div data-sheet-main><div role="menu" aria-label="Characters">
    <button type="button" class="kw-menu-item" role="menuitem"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg><span>New character</span></button>
    <button type="button" class="kw-menu-item" role="menuitem" data-sheet-forward aria-haspopup="menu"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8"/></svg><span>Sort by<small>Story order</small></span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></button>
    <button type="button" class="kw-menu-item" role="menuitem"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 15V3M7 10l5 5 5-5M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/></svg><span>Export cast list…</span></button>
  </div></div>
  <div data-sheet-destinations hidden>
    <button type="button" class="kw-text-button" data-sheet-back><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span>Menu</span></button>
    <form method="dialog" role="menu" aria-label="Sort by"><button type="submit" class="kw-menu-item" role="menuitemradio" aria-checked="true" value="act1"><span></span><span>Story order</span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg></button><button type="submit" class="kw-menu-item" role="menuitemradio" aria-checked="false" value="act2"><span></span><span>Name</span></button><button type="submit" class="kw-menu-item" role="menuitemradio" aria-checked="false" value="act3"><span></span><span>Scenes</span></button></form>
  </div>
</dialog>
<p class="kw-hint" data-example-result role="status"></p>
</div>
```

## Accessibility

- A modal dialog: focus moves in and returns to the trigger.
- The grip is decorative; closing must also work with a visible Close or Back and with Escape.

## For agents

### Rules

- **Must** replace desktop menus with a Sheet on phones.
- **Never** stack one sheet on another; drill down inside the same sheet.

### AI readiness test

**Task:** Show scene actions on a phone, including a submenu to move the scene to another act.

**Give the agent:** Sheet, Menu, Phones pattern.

**Constraint:** One sheet at a time.

**A reliable answer:**
- Sheet with actions
- "Move to act ›" drills into a second page in the same sheet with a Back row
- Delete last
