Blossom UI

Alert dialog

Alert dialog component to confirm destructive or important actions, with tones, a loading state and a safe default focus.

How to use it

Run npx @blossomui/react add alert-dialog, or copy src/components/UI/AlertDialog/AlertDialog.tsx into your React project and import it.

import { AlertDialog } from './components/ui/AlertDialog'

Props

AlertDialogProps

PropTypeDescription
open (required)boolean
onClose (required)() => voidCalled when the user cancels: the cancel button, Escape or, with `closeOnBackdrop`, a click outside.
onConfirm (required)() => voidCalled when the user confirms. The dialog does not close by itself: close it here, after the work is done.
title (required)string
childrenReactNodeWhat is going to happen and what it means.
toneAlertDialogTone`danger` for deleting something, `warning` for something that cannot be undone easily.
confirmLabelstringText of the confirm button.
cancelLabelstringText of the cancel button.
loadingbooleanShows a spinner in the confirm button and blocks the dialog while the work is done.
iconReactNodeIcon shown above the title. A default one is drawn for each tone.
confirmColorButtonColor | (string & {})Color of the confirm button. By default it follows `tone`.
closeOnBackdropbooleanClose when the user clicks outside. Off by default: an alert asks for an answer.

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree