Dialog

A modal dialog: 440, 560 or 720 wide, radius 14; title, description, body, actions. Enter in a field and ⌘Enter submit. Longer forms use StepDialog: one question per step.

View source
import { Dialog } from "@logicplanes/kaeso-ui";

Props

  • anchor
    "top" | "center" = top

    Where it sits: centered, or with a fixed top edge for content that changes height, so the title never moves.

  • busy
    boolean

    Keeps the dialog open while work it started is underway: Escape, a press outside, the close circle, Dialog.Close, Enter and ⌘Enter do nothing, so a request is never abandoned or sent twice.

  • children
    ReactNode

    The dialog's content and actions.

  • defaultOpen
    boolean

    Whether it starts open, when the component keeps its own state.

  • description
    ReactNode

    One sentence under the title.

  • footer
    ReactNode

    Right-aligned actions: Cancel (secondary) then the primary.

  • footerStart
    ReactNode

    A quiet action at the footer's start, such as a link to another way of doing the task.

  • headerStart
    ReactNode

    A top bar above the title, with this at its start and the close circle at its end (LayerDialog's back button). The title, description and content keep one left edge; null keeps the bar with an empty start.

  • hideClose
    boolean

    Hide the close circle (rare).

  • inline
    boolean

    Render without a portal and backdrop, for documentation and state matrices.

  • onOpenChange
    ((open: boolean) => void)

    Called when it opens or closes.

  • onSubmit
    (() => void)

    Enter in a single-line field and ⌘/Ctrl+Enter anywhere call this (usually the primary action); Enter in a text area, a search field, a combobox or a picker, and the Enter that confirms an input method's text, keep their own meaning.

  • open
    boolean

    Whether it is open, when you control it.

  • persistent
    boolean

    A press outside doesn't close it or move the focus, for forms that would lose what was typed; Escape and the close circle still close it. Every StepDialog is persistent.

  • size
    "md" | "sm" | "lg"

    The dialog's width.

  • title
    ReactNode

    The dialog's heading, also its accessible name; a long one, or an id, wraps.

  • toolbar
    ReactNode

    Controls that stay under the title while the body scrolls, such as a search over the list below; a hairline shows once the body is scrolled.

  • trigger
    ReactElement<unknown, string | JSXElementConstructor<any>>

    The trigger, a single element.