{"slug":"dialog","name":"Dialog","category":"Overlays","summary":"A modal surface for focused tasks and confirmations.","status":"stable","since":"0.1.0","import":"import { Dialog } from '@elluzion/iv-ui';","usage":["`open` is required and not bindable; set it to false from `onclose` to complete the close.","`footer` holds the actions; `size` caps the width.","Focus is trapped while open and restored on close."],"props":[{"name":"open","type":"boolean","default":"false","description":"Whether the dialog is visible. Set it to false from `onclose` to complete the close.","required":true,"bindable":false},{"name":"title","type":"string","default":"''","description":"Dialog title; also used as the accessible name.","required":false,"bindable":false},{"name":"size","type":"'sm' | 'md' | 'lg'","default":"'md'","description":"Maximum dialog width.","required":false,"bindable":false},{"name":"closeOnBackdrop","type":"boolean","default":"true","description":"Closes when the backdrop is clicked.","required":false,"bindable":false},{"name":"closeOnEscape","type":"boolean","default":"true","description":"Closes on Escape.","required":false,"bindable":false}],"events":[{"name":"close","type":"() => void","default":null,"description":"Called when the dialog requests to close; set `open = false` in response.","required":false,"bindable":false}],"snippets":[{"name":"children","type":"Snippet","default":null,"description":"Content rendered inside the component.","required":true,"bindable":false},{"name":"icon","type":"Snippet","default":null,"description":"Icon rendered before the title.","required":false,"bindable":false},{"name":"footer","type":"Snippet","default":null,"description":"Actions rendered below the body.","required":false,"bindable":false}],"types":[],"manual":[],"tokens":["--iv_blur","--iv_border","--iv_dialog-gap","--iv_dialog-lg","--iv_dialog-md","--iv_dialog-sm","--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_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"],"cssHooks":["iv-backdrop","iv-body","iv-body-no-title","iv-close-btn","iv-dialog","iv-dialog-lg","iv-dialog-sm","iv-footer","iv-header","iv-icon-slot","iv-title-area"],"accessibility":{"keyboard":[["Tab","Cycles focus inside the dialog."],["Escape","Closes the dialog unless `closeOnEscape` is false."]],"notes":["The surface uses `role=\"dialog\"` and `aria-modal=\"true\"`.","`title` is used for `aria-labelledby`; the body is linked through `aria-describedby`.","The backdrop click only closes when the click starts on the backdrop itself."]},"related":[{"title":"Sheet","summary":"A panel that slides in from an edge for secondary flows.","url":"/components/sheet","kind":"Component"},{"title":"AlertDialog","summary":"A blocking confirmation that returns a decision through an action.","url":"/components/alert-dialog","kind":"Component"},{"title":"Popover","summary":"A floating panel anchored to an element.","url":"/components/popover","kind":"Component"},{"title":"Card","summary":"A bordered surface for grouped content and actions.","url":"/components/card","kind":"Component"}],"examples":[{"id":"basic","title":"Basic","description":"A title, body content, and the close control.","code":"<script lang=\"ts\">\n\timport { Button, Dialog } from '@elluzion/iv-ui';\n\n\tlet open = $state(false);\n</script>\n\n<div class=\"stack\">\n\t<Button onclick={() => (open = true)}>Rename project</Button>\n\t<Dialog {open} title=\"Rename project\" onclose={() => (open = false)}>\n\t\t<p class=\"body\">The new name appears in the switcher and in every deploy record.</p>\n\t</Dialog>\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t}\n\n\t.body {\n\t\tmargin: 0;\n\t\tcolor: var(--iv_foreground-dim);\n\t\tfont-size: var(--iv_text-body);\n\t}\n</style>"},{"id":"sizes","title":"Sizes","description":"One dialog with a switchable `sm`, `md`, or `lg` width.","code":"<script lang=\"ts\">\n\timport { Button, Dialog } from '@elluzion/iv-ui';\n\n\tlet open = $state(false);\n\tlet size = $state<'sm' | 'md' | 'lg'>('md');\n</script>\n\n<div class=\"stack\">\n\t<div class=\"row\">\n\t\t<Button size=\"sm\" variant=\"outline\" onclick={() => ((size = 'sm'), (open = true))}>Small</Button\n\t\t>\n\t\t<Button size=\"sm\" variant=\"outline\" onclick={() => ((size = 'md'), (open = true))}\n\t\t\t>Medium</Button\n\t\t>\n\t\t<Button size=\"sm\" variant=\"outline\" onclick={() => ((size = 'lg'), (open = true))}>Large</Button\n\t\t>\n\t</div>\n\t<Dialog {open} title=\"Dialog size\" {size} onclose={() => (open = false)}>\n\t\t<p class=\"body\">The width is capped at the chosen step; content wraps inside it.</p>\n\t</Dialog>\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t}\n\n\t.row {\n\t\tdisplay: flex;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n\n\t.body {\n\t\tmargin: 0;\n\t\tcolor: var(--iv_foreground-dim);\n\t\tfont-size: var(--iv_text-body);\n\t}\n</style>"},{"id":"footer","title":"Footer","description":"Cancel and primary actions rendered in the footer.","code":"<script lang=\"ts\">\n\timport { Button, Dialog } from '@elluzion/iv-ui';\n\n\tlet open = $state(false);\n\tlet saved = $state(false);\n</script>\n\n<div class=\"stack\">\n\t<Button variant=\"primary\" onclick={() => (open = true)}>Edit retention</Button>\n\t<Dialog {open} title=\"Retention policy\" onclose={() => (open = false)}>\n\t\t<p class=\"body\">Logs older than the selected window are removed at the next sweep.</p>\n\t\t{#snippet footer()}\n\t\t\t<Button variant=\"ghost\" onclick={() => (open = false)}>Cancel</Button>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonclick={() => {\n\t\t\t\t\topen = false;\n\t\t\t\t\tsaved = true;\n\t\t\t\t}}>Save</Button\n\t\t\t>\n\t\t{/snippet}\n\t</Dialog>\n\t{#if saved}<p class=\"readout\">policy saved</p>{/if}\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n\n\t.body {\n\t\tmargin: 0;\n\t\tcolor: var(--iv_foreground-dim);\n\t\tfont-size: var(--iv_text-body);\n\t}\n\n\t.readout {\n\t\tmargin: 0;\n\t\tfont-family: var(--iv_font-mono);\n\t\tfont-size: var(--iv_text-sm);\n\t\tcolor: var(--iv_success);\n\t}\n</style>"}],"markdown":"/components/dialog.md","page":"/components/dialog"}