Sheet
One thing in detail, in a panel from the side of the window: a mission, an order, an upload. The page stays where it was underneath, so closing the sheet puts you back where you were.
Playground
<Sheet bind:open>
<SheetTrigger>
{#snippet child({ props })}<Button {...props}>Open mission</Button>{/snippet}
</SheetTrigger>
<SheetContent resizable storageKey="mission">
<SheetHeader>
<SheetTitle>Starefoss ledning, 12 Nov</SheetTitle>
<Badge status="active" size="sm">Ongoing</Badge>
{#snippet actions()}<MissionMenu />{/snippet}
</SheetHeader>
<SheetBody>
<SheetSection title="Details">...</SheetSection>
<SheetSection title="Notes">...</SheetSection>
</SheetBody>
<SheetFooter>
<SheetClose>{#snippet child({ props })}<Button {...props}>Cancel</Button>{/snippet}</SheetClose>
<Button variant="primary">Save</Button>
</SheetFooter>
</SheetContent>
</Sheet> Anatomy
Header
The height of the page header, so the two line up. Title on the left, then a status if it has one; actions and the close button on the right.
Body
Scrolls on its own, between a header and a footer that stay put. Sections split by dashed lines, 24px in from the edges.
Footer
Only when the sheet edits something: Cancel and Save, main action last. A sheet you only look at has none.
Edge
With resizable, the inner edge is a handle. Drag it, or focus it and use the arrows; double-click resets it.
Header height
Every bar that heads a region is one height, the --spacing-header token: the page header, the sidebar's top, a sheet's header. Use h-header, never a hard h-14, and they stay lined up if it changes.
Rules
- A sheet is for one thing you came from a list to look at. A task that stands on its own, like inviting someone, is a Dialog. A choice that needs an answer is a Confirm dialog.
- Right is the default. Left only for things that belong to the navigation, like a filter panel beside the list it filters.
- Make it resizable when what's in it varies in width, like tables, maps and logs, and give it a storageKey so it opens at the width the person chose last time.
- Non-modal (
modal={false}) when the page behind should stay usable, like clicking the next row in a list while the sheet shows the current one. - Never a sheet on a sheet. Open the next thing in the same sheet, or as its own page.
- The title is the thing's name, not "Details" or "Edit mission".