Overlay
Dialog
Modal overlay built on bits-ui — focus trap, ESC, click-outside, portal mount, scroll lock all handled. Bind open and the consumer drives visibility.
Examples
Basic
<Button onclick={() => open = true}>Open dialog</Button>
<Dialog bind:open title="Hello" description="A simple modal.">
<p>Body content goes here.</p>
</Dialog>With footer
<Dialog bind:open title="Save changes?" description="Your work will be saved to the cloud.">
<p>Body…</p>
{#snippet footer()}
<Button variant="ghost" onclick={() => open = false}>Cancel</Button>
<Button onclick={() => open = false}>Save</Button>
{/snippet}
</Dialog>size="lg"
<Dialog bind:open size="lg" title="Wide dialog">…</Dialog>Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Bindable open state. Use bind:open or set + listen to onOpenChange. |
title | string | — | Heading rendered with the display font. |
description | string | — | Optional muted line below the title. |
size | 'sm' | 'md' | 'lg' | 'md' | Max-width tier — 400 / 480 / 640. |
onOpenChange | (open: boolean) => void | — | Fires whenever the dialog opens or closes. |
footer | Snippet | — | Optional bottom action row. |
children | Snippet | — | Body content. |
Install
CLI
npm install bits-ui
npx @a3tai/mittsu add dialog