• Docs
  • Blog
    • 0.24.0

    • Switch to dark mode
    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Feature FlagsForLocal StoragePortalShowsplitPropsTheme

    Dialog

    The Dialog component is a modal that can be used to display content in a controlled manner.

    • npm
    • source
    • recipe
    • Ark
    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.

    Dialog Title

    This is a custom modal description

    Dialog Title

    This is a custom modal description

    Dialog Title

    This is a custom modal description

    Dialog Title

    This is a custom modal description

    Dialog Title

    This is a custom modal description

    Primitives

    You can utilize the primitive components or the css prop 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.

    C3rB3RuS R00lz!

    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.

    Note

    It is best to only use the DialogParts if you are building a custom solution. Importing Object based components will ship every property it includes into your bundle, regardless if you use it or not.

    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.

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs