Alert Dialog

A dialog that requires user response to proceed.

API reference

Import the component and place its parts the following way:

Anatomy
import { AlertDialog } from '@base-ui-components/react/alert-dialog';

<AlertDialog.Root>
  <AlertDialog.Trigger />
  <AlertDialog.Backdrop />
  <AlertDialog.Popup>
    <AlertDialog.Title />
    <AlertDialog.Description />
    <AlertDialog.Close />
  </AlertDialog.Popup>
</AlertDialog.Root>

Root

Groups all parts of the alert dialog. Doesn’t render its own HTML element.

PropTypeDefault
defaultOpenbooleanfalse
onOpenChange(open, event) => voidundefined
openbooleanundefined

Trigger

A button that opens the alert dialog. Renders a <button> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Backdrop

An overlay displayed beneath the popup. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
containerReact.Ref | HTMLElement | nullfalse
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

A container for the alert dialog contents. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
containerReact.Ref | HTMLElement | nullundefined
finalFocusReact.Refundefined
initialFocus| React.Ref
| (interactionType => HTMLElement | null)
undefined
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Title

A heading that labels the dialog. Renders an <h2> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Description

A paragraph with additional information about the alert dialog. Renders a <p> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Close

A button that closes the alert dialog. Renders a <button> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined