Dialog

Dialogs provide important prompts in a user flow.

import {
Dialog,
DialogTrigger,
DialogHeading,
DialogDescription,
DialogCloseTrigger,
DialogCloseIconTrigger,
} from '@cerberus/react'

Usage

To use the Dialog component, wrap it in a DialogProvider and use the DialogTrigger component to open the dialog. The Dialog component is a controlled component that can be used to display content in a modal.

With DatePicker

In order to display the DatePicker calendar in the correct layer, you need to add the withModal prop to the DatePickerCalendar component.

Sizes

The Dialog component supports different sizes. You can set the size prop to xs to lg, or full.

Primitives

You can utilize the primitive components to customize the dialog.

ComponentDescription
DialogProviderThe main state context for the dialog.
DialogTriggerThe trigger element that opens the dialog.
DialogBackdropThe backdrop that covers the page when the dialog is open.
DialogPositionerThe container that positions the dialog content.
DialogContentThe content that is shown within the dialog.
DialogHeadingThe heading title of the dialog.
DialogDescriptionThe description of the dialog.
DialogCloseTriggerThe trigger element that closes the dialog.
DialogCloseIconTriggerThe trigger element that closes the dialog with an "x" icon.

API

Props

The Dialog component is an abstraction of the primitives and accepts the following props:

NameDefaultDescription
sizesmThis size of the Dialog.

The Dialog component also accepts all the props of the DialogContent primitive props

Parts

The DialogParts API is an Object containing the full family of components.

NameDescription
RootThe DialogRoot primitive and context provider for the family.
TriggerThe DialogTrigger trigger element that opens the dialog.
BackdropThe DialogBackdrop that covers the page when the dialog is open.
PositionerThe DialogPositioner and container that positions the dialog content.
ContentThe DialogContent that is shown within the dialog.
HeadingThe DialogHeading which is the heading of the dialog.
DescriptionThe DialogDescription and description of the dialog.
CloseTriggerThe DialogCloseTrigger trigger element that closes the dialog.