Component
Dialog
A modal for a task the page cannot hold.
import { Dialog } from '@loidolt/theme-svelte';
Example
Notes
classtargets the portaled content, not the trigger.triggerVariant/triggerSizepick the button clothes; an explicittriggerClasswins wholesale, andtriggerChildreplaces the trigger outright.- Focus, portalling, dismissal, and the escape key come from Bits UI.
headerreplaces the visible title block;titleis still required and stays the accessible name, visually hidden.headerActionssit beside the close button.size="full"takes the viewport less a gutter.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
children required | Snippet | — | |
title required | string | — | |
class | string | — | class lands on the portaled Content element. |
closeLabel | string | 'Close dialog' | |
description | string | — | |
footer | Snippet | — | |
header | Snippet | — | Replaces the visible title block — for a header with media, a status badge or a custom layout. title is still required: it stays the dialog's accessible name, visually hidden. |
headerActions | Snippet | — | Controls beside the close button, e.g. an overflow menu or a "pop out" link. |
headingLevel | HeadingLevel | 2 | |
onOpenChange | (open: boolean) => void | — | |
open bindable | boolean | false | |
overlayClass | string | — | |
ref bindable | HTMLElement | null | null | |
showClose | boolean | true | |
size | DialogSize | — | Sets --ldt-dialog-width via a modifier class. Omit to inherit the CSS default. |
trigger | Snippet | — | Trigger contents, rendered inside a button styled with triggerClass. |
triggerChild | Snippet<[TriggerChildProps]> | — | Full control of the trigger element — receives the props Bits needs on it. |
triggerClass | string | — | |
triggerSize | ControlSize | — | |
triggerVariant | ActionVariant | — | Button variant for the default trigger. An explicit triggerClass wins wholesale. |
Plus the attributes of Omit<DialogContentProps, 'children' | 'class' | 'child'>, forwarded to the root element.