XiodUI
HomeDocs
OverviewComponentsStyling & CustomizationChangelog

Components

  • Accordion
  • Agent Steps
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Button Split
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Circular Progress
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy To Clipboard
  • Corner Badge
  • Dashboard Grid
  • Date Picker
  • Dialog
  • Dot Matrix
  • Draggable
    Updated
  • Drawer
  • Empty
  • Field
  • Fieldset
  • File Upload
    Updated
  • Form
  • Frame
  • Gauge
  • Grid
  • Group
  • Input
  • Input Group
  • Input OTP
  • Input Payment
  • Input Phone
    Updated
  • Input Sensitive
  • Kbd
  • Kinetic Click
  • Label
  • List Box
    Updated
  • Loader
  • Marker
  • Menu
  • Menubar
  • Message
  • Meter
  • Morphic Toast
  • Navigation Menu
  • Number Field
  • Option Picker
  • Orb
  • Pagination
  • Popover
  • Preview Card
    Updated
  • Progress
  • Radio
  • Resizable
  • Ruler Picker
  • Scroll Area
  • Scroll Bar
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Switch
  • Table
  • Tabs
  • Text
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
  • Waveform
  • Wheel Picker

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Dialog

Previous: Date PickerNext: Dot Matrix

A modal window that opens over the page.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import {2  Dialog,3  DialogBackdrop,4  DialogClose,5  DialogDescription,6  DialogFooter,7  DialogHeader,8  DialogPanel,9  DialogPopup,10  DialogPortal,11  DialogTitle,12  DialogTrigger,13  DialogViewport,14  DialogCreateHandle15} from "xiod-ui/dialog";

Anatomy

1<Dialog>2  <DialogTrigger />3  <DialogPopup>4    <DialogHeader>5      <DialogTitle />6      <DialogDescription />7    </DialogHeader>8    <DialogPanel />9    <DialogFooter>10      <DialogClose />11    </DialogFooter>12  </DialogPopup>13</Dialog>

API Reference

Detailed documentation of properties and options.

Dialog

PropTypeDefaultDescription
actionsRef
RefObject<DialogRootActions | null>
–

A ref to imperative actions.

  • unmount: Ends the closing phase of the dialog after an externally controlled closing animation finishes.

Call preventUnmountOnClose() in onOpenChange first, otherwise the dialog completes closing on its own. Whether it leaves the DOM is decided by keepMounted on the portal.

Date PickerDot Matrix
  • close: Closes the dialog imperatively when called.
  • children
    ReactNode | PayloadChildRenderFunction<Payload>
    –

    The content of the dialog. This can be a regular React node or a render function that receives the payload of the active trigger.

    defaultOpen
    boolean
    false

    Whether the dialog is initially open.

    To render a controlled dialog, use the open prop instead.

    defaultTriggerId
    string|null
    –

    ID of the trigger that the dialog is associated with. This is useful in conjunction with the defaultOpen prop to create an initially open dialog.

    disablePointerDismissal
    boolean
    false

    Whether to prevent the dialog from closing on outside presses. For non-modal dialogs, this also prevents the dialog from closing when focus moves outside of it.

    handle
    DialogHandle<Payload>
    –

    A handle to associate the dialog with a trigger. If specified, allows external triggers to control the dialog's open state. Can be created with the Dialog.createHandle() method.

    modal
    boolean|"trap-focus"
    true

    Determines if the dialog enters a modal state when open.

    • true: user interaction is limited to just the dialog: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled.
    • false: user interaction with the rest of the document is allowed.
    • 'trap-focus': focus is trapped inside the dialog, but document page scroll is not locked and pointer interactions outside of it remain enabled.

    When modal is true or 'trap-focus', render <Dialog.Close> inside <Dialog.Popup> so touch screen readers can escape the popup.

    onOpenChange
    ((open: boolean, eventDetails: DialogRootChangeEventDetails) => void)
    –

    Event handler called when the dialog is opened or closed.

    onOpenChangeComplete
    ((open: boolean) => void)
    –

    Event handler called after any animations complete when the dialog is opened or closed.

    open
    boolean
    –

    Whether the dialog is currently open.

    triggerId
    string|null
    –

    ID of the trigger that the dialog is associated with. This is useful in conjunction with the open prop to create a controlled dialog. There's no need to specify this prop when the dialog is uncontrolled (that is, when the open prop is not set).

    DialogBackdrop

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    forceRender
    boolean
    false

    Whether the backdrop is forced to render even when nested.

    DialogClose

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    nativeButton
    boolean
    true

    Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).

    DialogDescription

    Accepts className, style and render, plus every native attribute of the element it renders.

    DialogFooter

    Accepts render, plus every native <div> attribute.

    PropTypeDefaultDescription
    variant
    "default"|"bare"
    default

    The visual style of the component.

    DialogHeader

    Accepts render, plus every native <div> attribute.

    DialogPanel

    Accepts render, plus every native <div> attribute.

    PropTypeDefaultDescription
    scrollFade
    boolean
    true

    Whether the content fades out at an edge that has more to scroll to.

    DialogPopup

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    bottomStickOnMobile
    boolean
    true

    Whether the dialog docks to the bottom edge as a full-width sheet on small screens.

    closeIcon
    ReactNode
    –

    Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

    closeProps
    DialogCloseProps
    –

    Props for the close button, such as aria-label or className.

    finalFocus
    boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)
    –

    Determines the element to focus when the dialog is closed.

    • false: Do not move focus.
    • true: Move focus based on the default behavior (trigger or previously focused element).
    • RefObject: Move focus to the ref element.
    • function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, null to fall back to the default behavior, or false/undefined to do nothing.
    initialFocus
    boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | void | HTMLElement | null)
    –

    Determines the element to focus when the dialog is opened. By default, focus moves to the first tabbable element inside the popup, except when the dialog is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard.

    • false: Do not move focus.
    • true: Move focus based on the default behavior (first tabbable element or popup).
    • RefObject: Move focus to the ref element.
    • function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, null to fall back to the default behavior, or false
    labels
    Partial<CloseLabels>
    –

    Replaces the built-in text of this dialog. Takes precedence over LabelsProvider.

    showCloseButton
    boolean
    true

    Whether to show the close button in the top corner.

    DialogPortal

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    container
    HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null
    –

    A parent element to render the portal element into.

    keepMounted
    boolean
    false

    Whether to keep the portal mounted in the DOM while the popup is hidden.

    DialogTitle

    Accepts className, style and render, plus every native attribute of the element it renders.

    DialogTrigger

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    handle
    DialogHandle<unknown>
    –

    A handle to associate the trigger with a dialog. Can be created with the Dialog.createHandle() method.

    id
    string
    –

    ID of the trigger. In addition to being forwarded to the rendered element, it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot triggerId prop).

    nativeButton
    boolean
    true

    Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).

    payload
    unknown
    –

    A payload to pass to the dialog when it is opened.

    DialogViewport

    Accepts className, style and render, plus every native attribute of the element it renders.

    Helpers

    DialogCreateHandle is called, not rendered. It creates a handle: pass it as handle to a trigger and to the root, and the trigger can sit anywhere in the tree, outside the root.

    /
    undefined
    to do nothing.