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

Alert Dialog

Previous: AlertNext: Aspect Ratio

A modal dialog that asks the user to confirm or cancel before continuing.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import {2  AlertDialog,3  AlertDialogBackdrop,4  AlertDialogClose,5  AlertDialogDescription,6  AlertDialogFooter,7  AlertDialogHeader,8  AlertDialogPopup,9  AlertDialogPortal,10  AlertDialogTitle,11  AlertDialogTrigger,12  AlertDialogViewport,13  AlertDialogCreateHandle14} from "xiod-ui/alert-dialog";

Anatomy

1<AlertDialog>2  <AlertDialogTrigger />3  <AlertDialogPopup>4    <AlertDialogHeader>5      <AlertDialogTitle />6      <AlertDialogDescription />7    </AlertDialogHeader>8    <AlertDialogFooter>9      <AlertDialogClose />10    </AlertDialogFooter>11  </AlertDialogPopup>12</AlertDialog>

API Reference

Detailed documentation of properties and options.

AlertDialog

PropTypeDefaultDescription
actionsRef
RefObject<DialogRootActions | null>
–

A ref to imperative actions.

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

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

AlertAspect Ratio
  • close: Closes the alert 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.

    handle
    AlertDialogHandle<Payload>
    –

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

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

    Event handler called when the alert 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).

    AlertDialogBackdrop

    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.

    AlertDialogClose

    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>).

    AlertDialogDescription

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

    AlertDialogFooter

    Accepts render, plus every native <div> attribute.

    PropTypeDefaultDescription
    variant
    "default"|"bare"
    default

    The visual style of the component.

    AlertDialogHeader

    Accepts render, plus every native <div> attribute.

    AlertDialogPopup

    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.

    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

    AlertDialogPortal

    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.

    AlertDialogTitle

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

    AlertDialogTrigger

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

    PropTypeDefaultDescription
    handle
    AlertDialogHandle<unknown>
    –

    A handle to associate the trigger with an alert dialog. Can be created with the AlertDialog.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.

    AlertDialogViewport

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

    Helpers

    AlertDialogCreateHandle 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.