Dialog

A modal window that overlays the main content, requiring user interaction before returning to the parent view.

Basic

A simple dialog with a title, description, and action buttons.

With Form

A dialog containing form inputs for collecting user information.

Usage

julia
using Suite

Dialog(
    DialogTrigger(
        Button(variant="outline", "Open Dialog")
    ),
    DialogContent(
        DialogHeader(
            DialogTitle("Dialog Title"),
            DialogDescription("A brief description of the dialog purpose."),
        ),
        P("Your dialog content goes here."),
        DialogFooter(
            DialogClose(Button(variant="outline", "Cancel")),
            Button("Confirm"),
        ),
    ),
)

Keyboard Interactions

KeyAction
EscapeClose the dialog
TabCycle focus through focusable elements inside the dialog
Shift + TabCycle focus backward through focusable elements

Accessibility

AttributeApplied ToPurpose
role="dialog"DialogContentIdentifies the element as a dialog
aria-modal="true"DialogContentIndicates that the dialog is modal and blocks interaction with the rest of the page
aria-describedbyDialogContentPoints to the DialogDescription for screen readers

API Reference

Dialog

PropTypeDefaultDescription
children...Any-Dialog sub-components (trigger, content)

DialogTrigger

PropTypeDefaultDescription
children...Any-The trigger element that opens the dialog

DialogContent

PropTypeDefaultDescription
children...Any-Dialog body content
classString""Additional CSS classes

DialogHeader

PropTypeDefaultDescription
children...Any-Header content (title, description)
classString""Additional CSS classes

DialogFooter

PropTypeDefaultDescription
children...Any-Footer content (action buttons)
classString""Additional CSS classes

DialogTitle

PropTypeDefaultDescription
children...Any-Dialog title text
classString""Additional CSS classes

DialogDescription

PropTypeDefaultDescription
children...Any-Dialog description text
classString""Additional CSS classes

DialogClose

PropTypeDefaultDescription
children...Any-Close button content
classString""Additional CSS classes