• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
    • WysiwygInput
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • Switch
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • DnDnpm version

    • Overview
  • Page-Buildernpm version

    • Overview
  • Page-Builder-CMSnpm version

    • Overview
  • Page-Builder-Webnpm version

    • Overview
  • Sentrynpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

Dialog

Low-level overlay primitive: a portalled, scroll-locked backdrop with a focus-trapped, centered panel. DialogPanel is the white rounded content container placed inside it.

When to use

Dialog is the lowest-level overlay in the family and expects Floating UI plumbing (context, getFloatingProps, a floating ref). Most code should not use it directly — reach for Modal / openModal (@uxf/ui/modal), which wraps Dialog, supplies that plumbing, and adds a controlled isOpen / onClose API plus the modal stack.

Use Dialog (or the useDialog hook) directly only for a bespoke overlay outside the modal stack. Use DialogPanel wherever you need the standard panel container — it is the usual child of a Modal.

Usage

The useDialog hook wires up Floating UI and returns everything Dialog needs. It lives in the same file but is not re-exported from index.ts, so import it from the file directly:

import { Button } from "@uxf/ui/button";
import { useDialog } from "@uxf/ui/dialog/dialog";

function Example() {
    const { openDialog, DialogProvider, closeDialog } = useDialog();

    return (
        <>
            <Button onClick={() => openDialog(<Button onClick={closeDialog}>Close</Button>)}>Open</Button>
            <DialogProvider />
        </>
    );
}

useDialog returns:

  • openDialog(content) – shows content; called on an open dialog, it replaces the content. The dialog itself (portal, overlay, focus trap, scroll lock) stays mounted, the content mounts afresh on every call, so no state carries over from the previous content.
  • closeDialog() – closes it and calls onDialogClose.
  • DialogProvider – renders the dialog; accepts className, variant and style. It is the same component for the lifetime of the hook. It renders what openDialog was given and ignores children.
  • getFloatingElementProps – Floating UI reference props for an element that should toggle the dialog.

Options: isBackdropCloseDisabled, isEscapeKeyCloseDisabled, onDialogClose.

DialogPanel gives content the standard panel styling and width:

import { DialogPanel } from "@uxf/ui/dialog";

<DialogPanel width="sm">Panel content</DialogPanel>;

Props

Dialog

Imported from @uxf/ui/dialog.

PropTypeDefaultDescription
isOpenboolean— (required)Whether the overlay is rendered.
contextUseFloatingReturn["context"]— (required)Floating UI context (from useFloating).
refRef<HTMLDivElement>— (required)Floating element ref (refs.setFloating).
getFloatingProps(userProps?) => Partial<Record<string, unknown>>— (required)Floating UI interaction props getter.
childrenReactNode—Overlay content, typically a DialogPanel.
variantDialogVariant"default"Visual variant (default, drawer-right).
classNamestring—Extra class on the overlay.
styleCSSProperties—Inline style on the overlay.

DialogPanel

Imported from @uxf/ui/dialog.

PropTypeDefaultDescription
widthDialogPanelWidth"default"Panel max-width (see below).
childrenReactNode—Panel content.
classNamestring—Extra class on the panel.

Variants & states

DialogVariant: default, drawer-right (right-anchored drawer on sm screens and up).

DialogPanelWidth maps to a max-width:

WidthMax width
xsxs
smsm
defaultlg
lg3xl
xl5xl

Requirements

Import the component stylesheet once in your global CSS:

@import url("@uxf/ui/css/dialog.css");

Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.

Default
Open in new tab