Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

Dialog

A modal for a task the page cannot hold.

import { Dialog } from '@loidolt/theme-svelte';

Example

Notes

  • class targets the portaled content, not the trigger. triggerVariant/triggerSize pick the button clothes; an explicit triggerClass wins wholesale, and triggerChild replaces the trigger outright.
  • Focus, portalling, dismissal, and the escape key come from Bits UI.
  • header replaces the visible title block; title is still required and stays the accessible name, visually hidden. headerActions sit 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.

Dialog props
PropTypeDefaultNotes
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 HeadingLevel2
onOpenChange (open: boolean) => void—
open bindablebooleanfalse
overlayClass string—
ref bindableHTMLElement | nullnull
showClose booleantrue
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.