Staffbase

Components

Dialog

Dialogs present focused content or actions in a modal overlay above the main page.

Anatomy

Anatomy
import {Dialog} from '@staffbase/design';

<Dialog.Root>
  <Dialog.Trigger />
  <Dialog.Popup>
    <Dialog.Header>
      <Dialog.Title />
      <Dialog.Close />
    </Dialog.Header>
    <Dialog.Body>
      <Dialog.Description />
    </Dialog.Body>
    <Dialog.Footer />
  </Dialog.Popup>
</Dialog.Root>

API reference

Root

Inherits props fromBase UI Dialog Root

Groups all parts of the dialog and manages its open state.

Trigger

Inherits props fromBase UI Dialog Trigger
Name Type Description
children
ReactNode
Opens the dialog when activated. Passed as a single button element, not via a render prop.

Close

Inherits props fromBase UI Dialog Close

Dismisses the dialog when activated.

Name Type Description
children
ReactNode
The element that closes the dialog. Passed as a single button element, not via a render prop.
Inherits props fromBase UI Dialog Popup

Renders the modal surface and its backdrop, portalled out of the DOM flow.

Name Type Description
children
ReactNode
The content of the dialog, typically a header, body, and footer.
container
HTMLElementRefObject<HTMLElement>
Use this instead of z-index to specify another parent element to render the dialog portal into. Default is the document body.

Renders a <div> that lays out the title and close button.

Name Type Description
children
ReactNode
The header content, typically a title and a close button.

Body

Renders a <div> for the main content of the dialog.

Name Type Description
children
ReactNode
The main content of the dialog.

Renders a <div> that lays out the dialog’s actions.

Name Type Description
children
ReactNode
The footer content, typically action buttons.

Title

Inherits props fromBase UI Dialog Title

Renders an <h2> element that labels the dialog.

Name Type Description
children
ReactNode
A heading that labels the dialog.

Description

Inherits props fromBase UI Dialog Description

A visually hidden element available and recommended to use.

Name Type Description
children
ReactNode
A description that provides additional context for the dialog.