Dialog
Modal dialog using native dialog element
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Dialog } from '@dryui/ui';
</script>
<Dialog.Root bind:open={showDialog}>
<Dialog.Trigger>
<Button>Open Dialog</Button>
</Dialog.Trigger>
<Dialog.Content>
<Dialog.Header>Confirm</Dialog.Header>
<p>Are you sure?</p>
<Dialog.Footer>
<Button variant="outline" onclick={() => showDialog = false}>Cancel</Button>
<Button variant="solid" onclick={handleConfirm}>Confirm</Button>
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>Import options
Root package
import { Dialog } from '@dryui/ui'Per-component subpath
import { Dialog } from '@dryui/ui/dialog'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Edit Profile Dialog
Opens a modal dialog with a form.
<Dialog.Root>
<Dialog.Trigger>
<Button>Edit Profile</Button>
</Dialog.Trigger>
<Dialog.Overlay />
<Dialog.Content>
<Dialog.Header>Edit Profile</Dialog.Header>
<Dialog.Body>
<Stack gap="md">
<p>Make changes to your profile here. Click save when you're done.</p>
<div class="field">
<Label for="dialog-name">Name</Label>
<Input id="dialog-name" value="Sofia Rodriguez" />
</div>
<div class="field">
<Label for="dialog-email">Email</Label>
<Input id="dialog-email" type="email" value="sofia@example.com" />
</div>
</Stack>
</Dialog.Body>
<Dialog.Footer>
<Dialog.Close>Cancel</Dialog.Close>
<Button>Save changes</Button>
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>Structure
Compound components always start with Dialog.Root. Use this structure block to understand required wrappers before you wire state or styling.
Dialog.Root
Dialog.Trigger
Dialog.Content
Dialog.Header
Dialog.Footer Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with Dialog.Root, then add only the parts you need.
Dialog.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
open | boolean | false | — | — |
children | Snippet | — | ✓ | — |
Also accepts standard HTML attributes (class, style, id, etc.)
Dialog.Trigger
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Dialog.Content
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards native HTML attributes via rest props.
Dialog.Overlay
| Prop | Type | Default | Required | Bindable |
|---|
Forwards <div> attributes via rest props. Common examples: id, style, role.
Dialog.Header
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Dialog.Body
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Dialog.Footer
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Dialog.Close
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <button> attributes via rest props. Common examples: type, disabled, name.