Overview Button Copy button Field Input Number field Textarea Select Combobox Multiselect Date picker Date range picker Date-time picker Checkbox Radio group Position picker Switch Slider Dropzone Device controls Avatar Badge Card Collapsible Kbd Map Matrix Proportion bar Separator Stat Table Timeline Chat Playback Pagination Charts Chart theming Profile chart Time series chart Bar chart Isopleth chart TS diagram Box plot Rose chart Calendar chart Banner Toast Loader Progress Skeleton Empty state Error state Dropdown menu Tooltip Info tooltip Dialog Sheet Resizable Confirm dialog Breadcrumbs Command palette Mobile menu Navigation list Outline Scroll rail Sidebar Tabs
Dialog
A task on its own, over the page. The app's dialog: on the most raised surface with a hairline edge, divided into header, sections and footer.
Example
<Dialog bind:open>
<DialogTrigger>
{#snippet child({ props })}<Button {...props} variant="primary">Invite</Button>{/snippet}
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Invite a member</DialogTitle>
<DialogDescription>They get an email with a link to join.</DialogDescription>
</DialogHeader>
<DialogSection class="grid gap-6">
<Field label="Email"><Input type="email" /></Field>
<Field label="Role"><Select options={roles} /></Field>
</DialogSection>
<DialogFooter>
<DialogClose>{#snippet child({ props })}<Button {...props}>Cancel</Button>{/snippet}</DialogClose>
<Button variant="primary" loadingText="Sending..." {...invite.button} onclick={invite.run}>
Send invite
</Button>
</DialogFooter>
</DialogContent>
</Dialog> Anatomy
- Header
- Title, and a description when it adds something. A line under it.
- Sections
- The body, 24px in from the edges. More than one are split by dashed lines.
- Footer
- Actions on the right, main one last. A line over it. Stacked on a phone, main one on top.
- Close
- The X top right, Escape, or a click outside. All of them mean cancel.
Rules
- For a short task that needs the page behind it. Anything longer gets its own page.
- The title says the task, as in the button that opened it: "Invite a member".
- The main button names the action ("Send invite"), never OK or Submit.
- Asking before something can't be undone: the Confirm dialog, not a hand-built one.