---
title: "Sheet"
description: "A panel that slides in from an edge for secondary flows."
category: "Overlays"
slug: sheet
url: /components/sheet
since: "0.1.0"
status: "stable"
---

# Sheet

A panel that slides in from an edge for secondary flows.

## Import

```svelte
import { Sheet } from '@elluzion/iv-ui';
```

## Preview

One sheet that slides in from any of the four edges.

```svelte
<script lang="ts">
	import type { SheetSide } from '@elluzion/iv-ui';
	import { Button, Sheet } from '@elluzion/iv-ui';

	let open = $state(false);
	let side = $state<SheetSide>('right');
</script>

<div class="stack">
	<div class="row">
		{#each ['left', 'right', 'top', 'bottom'] as edge (edge)}
			<Button
				size="sm"
				variant="outline"
				onclick={() => {
					side = edge as SheetSide;
					open = true;
				}}>{edge}</Button
			>
		{/each}
	</div>
	<Sheet bind:open {side} title="Sheet from the {side}">
		<p class="body">The panel slides in from the chosen edge and traps focus until it closes.</p>
	</Sheet>
</div>

<style>
	.stack {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: var(--iv_spacing-md);
	}

	.row {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: var(--iv_spacing-sm);
	}

	.body {
		margin: 0;
		color: var(--iv_foreground-dim);
		font-size: var(--iv_text-body);
	}
</style>
```

## Usage

- `side` chooses the edge; `size` sets the width, or the height for top and bottom sheets.
- Bind `open`; the component closes itself and calls `onclose` when dismissed.
- Use for filters, details, or compact forms; use `Dialog` for a decision.

## Examples

### Sizes

`sm`, `md`, `lg`, and `full` width steps.

```svelte
<script lang="ts">
	import type { SheetSize } from '@elluzion/iv-ui';
	import { Button, Sheet } from '@elluzion/iv-ui';

	let open = $state(false);
	let size = $state<SheetSize>('md');
</script>

<div class="stack">
	<div class="row">
		{#each ['sm', 'md', 'lg', 'full'] as step (step)}
			<Button
				size="sm"
				variant={size === step ? 'primary' : 'outline'}
				onclick={() => {
					size = step as SheetSize;
					open = true;
				}}>{step}</Button
			>
		{/each}
	</div>
	<Sheet bind:open {size} title="Size {size}" side="right">
		<p class="body">Width is capped by the size step; full takes the whole viewport.</p>
	</Sheet>
</div>

<style>
	.stack {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: var(--iv_spacing-md);
	}

	.row {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: var(--iv_spacing-sm);
	}

	.body {
		margin: 0;
		color: var(--iv_foreground-dim);
		font-size: var(--iv_text-body);
	}
</style>
```

### Footer

A sticky footer keeps the actions in reach.

```svelte
<script lang="ts">
	import { Button, Field, Input, Sheet } from '@elluzion/iv-ui';

	let open = $state(false);
	let name = $state('Orbital');
	let saved = $state(false);
</script>

<div class="stack">
	<Button onclick={() => (open = true)}>Edit workspace</Button>
	<Sheet bind:open title="Workspace" side="right">
		<Field label="Name" htmlFor="sheet-name">
			<Input id="sheet-name" bind:value={name} />
		</Field>
		{#snippet footer()}
			<Button variant="ghost" onclick={() => (open = false)}>Cancel</Button>
			<Button
				variant="primary"
				onclick={() => {
					open = false;
					saved = true;
				}}>Save</Button
			>
		{/snippet}
	</Sheet>
	{#if saved}<p class="readout">saved {name}</p>{/if}
</div>

<style>
	.stack {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: var(--iv_spacing-sm);
	}

	.readout {
		margin: 0;
		font-family: var(--iv_font-mono);
		font-size: var(--iv_text-sm);
		color: var(--iv_success);
	}
</style>
```

### Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` **required** **bindable** | `boolean` | `false` | Whether the sheet is visible. Bind with `bind:open`. |
| `side` | `SheetSide` | `'bottom'` | Edge the sheet slides in from. |
| `size` | `SheetSize` | `'md'` | Sheet width (or height for top/bottom sheets). |
| `title` | `string` | `''` | Sheet title; also used as the accessible name. |
| `closeOnBackdrop` | `boolean` | `true` | Closes when the backdrop is clicked. |
| `closeOnEscape` | `boolean` | `true` | Closes on Escape. |
| `showCloseButton` | `boolean` | `true` | Shows the header close button. |
| `className` | `string` | `''` | Extra classes merged onto the root element. |

`class`, `id`, `style`, `aria-*`, and `data-*` are forwarded through rest props.

### Events

| Event | Handler type | Description |
| --- | --- | --- |
| `close` | `() => void` | Called when the sheet requests to close; set `open = false` in response. |

The legacy `on:name` form is accepted for every event.

### Snippets

| Snippet | Type | Description |
| --- | --- | --- |
| `children` | `Snippet` | Content rendered inside the component. |
| `icon` | `Snippet` | Icon rendered before the title. |
| `footer` | `Snippet` | Actions rendered below the body. |

### Types

#### `SheetSide`

Edge the sheet slides in from.

```ts
type SheetSide = 'left' | 'right' | 'top' | 'bottom';
```

#### `SheetSize`

Sheet width or height step.

```ts
type SheetSize = 'sm' | 'md' | 'lg' | 'full';
```

### Tokens used

`--iv_blur` · `--iv_border` · `--iv_ease-in-out` · `--iv_font-sans` · `--iv_foreground` · `--iv_foreground-dim` · `--iv_overlay` · `--iv_radius-lg` · `--iv_radius-sm` · `--iv_ring` · `--iv_ring-width` · `--iv_shadow-lg` · `--iv_sheet-lg` · `--iv_sheet-md` · `--iv_sheet-sm` · `--iv_spacing-2xl` · `--iv_spacing-lg` · `--iv_spacing-md` · `--iv_spacing-sm` · `--iv_spacing-xl` · `--iv_surface-raised` · `--iv_text-xl` · `--iv_transition-base` · `--iv_z-overlay`

See the [token reference](/foundations/tokens.md) for values.

### CSS hooks

`.iv-backdrop` · `.iv-body` · `.iv-body-no-title` · `.iv-close-btn` · `.iv-footer` · `.iv-header` · `.iv-icon-slot` · `.iv-sheet` · `.iv-sheet-full` · `.iv-sheet-lg` · `.iv-sheet-sm` · `.iv-side-bottom` · `.iv-side-left` · `.iv-side-right` · `.iv-side-top` · `.iv-title-area`

## Accessibility

| Keys | Action |
| --- | --- |
| `Tab` | Cycles focus inside the sheet. |
| `Escape` | Closes the sheet unless `closeOnEscape` is false. |

- The surface uses `role="dialog"` and `aria-modal="true"`.
- The title names the sheet; the body is linked through `aria-describedby`.
- Focus is trapped while open and restored on close.

## Related

- [Dialog](/components/dialog.md)
- [AlertDialog](/components/alert-dialog.md)
- [Popover](/components/popover.md)
- [Card](/components/card.md)