Homelogologo
Sponsor

Dialog

Displays a modal dialog prompt.

Usage

A component that presents modal content that requires user focus.

import { Dialog, Portal } from "@elemnts-ui/react"; <Dialog.Root> <Dialog.Trigger /> <Portal> <Dialog.Backdrop /> <Dialog.Positioner> <Dialog.Content> <Dialog.Title>Title</Dialog.Title> <Dialog.Description>Description</Dialog.Description> <Dialog.CloseTrigger /> </Dialog.Content> </Dialog.Positioner> </Portal> </Dialog.Root>;

Sizes

Adjust the dialog’s dimensions using the size prop.

Cover

Set size="cover" to expand the dialog to full-screen while leaving a small portion of the underlying page visible.

Fullscreen

Set the size prop to full to render the dialog in full-screen, occupying the entire viewport.

Placements

Set the placement prop to control where the dialog appears (top, center, bottom).

API Reference

DialogBackdrop

The backdrop component for the dialog.

PropTypeDefault
asChildbooleanfalse

DialogCloseTrigger

The close trigger component for the dialog.

PropTypeDefault
asChildbooleanfalse

DialogContent

The content component for the dialog.

PropTypeDefault
asChildbooleanfalse

DialogDescription

The description component for the dialog.

PropTypeDefault
asChildbooleanfalse

DialogPositioner

The positioner component for the dialog.

PropTypeDefault
asChildbooleanfalse

DialogRoot

The root component for the dialog.

PropTypeDefault
aria-labelstring-
closeOnEscapebooleantrue
closeOnInteractOutsidebooleantrue
defaultOpenbooleanfalse
defaultTriggerValuestring-
finalFocusEl() => MaybeElement-
hideModeHideMode'display-none'
immediateboolean-
initialFocusEl() => MaybeElement-
lazyMountbooleanfalse
modalbooleantrue
onEscapeKeyDown(event: KeyboardEvent) => void-
onExitCompleteVoidFunction-
onFocusOutside(event: FocusOutsideEvent) => void-
onInteractOutside(event: InteractOutsideEvent) => void-
onOpenChange(details: OpenChangeDetails) => void-
onPointerDownOutside(event: PointerDownOutsideEvent) => void-
onRequestDismiss(event: LayerDismissEvent) => void-
onTriggerValueChange(details: TriggerValueChangeDetails) => void-
openboolean-
persistentElements`(() => Elementnull)[]`
presentboolean-
preventScrollbooleantrue
restoreFocusboolean-
role`'dialog''alertdialog'`
skipAnimationOnMountbooleanfalse
trapFocusbooleantrue
triggerValuestring-
unmountOnExitbooleanfalse

DialogRootProvider

The root provider component for the dialog.

PropTypeDefault
valueUseDialogReturnrequired
asChildbooleanfalse
hideModeHideMode'display-none'
immediateboolean-
lazyMountbooleanfalse
onExitCompleteVoidFunction-
presentboolean-
skipAnimationOnMountbooleanfalse
unmountOnExitbooleanfalse

DialogTitle

The title component for the dialog.

PropTypeDefault
asChildbooleanfalse

DialogTrigger

The trigger component for the dialog.

PropTypeDefault
asChildbooleanfalse
valuestring-

DialogRoot

The root element of the dialog.

PropTypeDefault
closeOnEscapebooleanfalse
closeOnInteractOutsidebooleanfalse
defaultOpenbooleanfalse
defaultTriggerValuestringundefined
finalFocusEl() => MaybeElementundefined
hideModeHideModeundefined
immediatebooleanfalse
initialFocusEl() => MaybeElementundefined
modalbooleanfalse
onEscapeKeyDown(event: KeyboardEvent) => voidundefined
onExitCompleteVoidFunctionundefined
onFocusOutside(event: FocusOutsideEvent) => voidundefined
onInteractOutside(event: InteractOutsideEvent) => voidundefined
onOpenChange(details: OpenChangeDetails) => voidundefined
onPointerDownOutside(event: PointerDownOutsideEvent) => voidundefined
onRequestDismiss(event: LayerDismissEvent) => voidundefined
onTriggerValueChange(details: TriggerValueChangeDetails) => voidundefined
openbooleanfalse
persistentElements(() => Element | null)[]undefined
presentbooleanfalse
preventScrollbooleanfalse
restoreFocusbooleanfalse
role'dialog' | 'alertdialog'undefined
skipAnimationOnMountbooleanfalse
trapFocusbooleanfalse
triggerValuestringundefined