Sheet
A panel that slides in from an edge for secondary flows.
import { Sheet } from '@elluzion/iv-ui'; 01 Preview
Sides
One sheet that slides in from any of the four edges.
Source· svelte Show Hide
<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>02 Usage
sidechooses the edge;sizesets the width, or the height for top and bottom sheets.- Bind
open; the component closes itself and callsonclosewhen dismissed. - Use for filters, details, or compact forms; use
Dialogfor a decision.
03 Examples
Sizes
sm, md, lg, and full width steps.
Source· svelte Show Hide
<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.
Source· svelte Show Hide
<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>04 API
import { Sheet } from '@elluzion/iv-ui';Props
8 props · 1 events · 3 snippets| 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 |
|---|---|---|
| onclose | () => 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.
type SheetSide = 'left' | 'right' | 'top' | 'bottom';SheetSize
Sheet width or height step.
type SheetSize = 'sm' | 'md' | 'lg' | 'full';05 Accessibility
| Keys | Action |
|---|---|
| Tab | Cycles focus inside the sheet. |
| Escape | Closes the sheet unless closeOnEscape is false. |
- The surface uses
role="dialog"andaria-modal="true". - The title names the sheet; the body is linked through
aria-describedby. - Focus is trapped while open and restored on close.
06 Tokens & CSS hooks
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
Class 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