Blossom UI

Toasts

Toast notifications in five colors with actions, plus the useToasts hook and Toaster to manage a stack of messages.

How to use it

Run npx @blossomui/react add toast, or copy src/components/UI/Toasts/Toast.tsx into your React project and import it.

import { Toast, useToasts, Toaster } from './components/ui/Toast'

Props

ToastProps

PropTypeDescription
dismissLabelstringAccessible name of the dismiss button.
colorToastColor | (string & {})A preset, `accent` for the brand color or any CSS color. A custom color fills the toast and the text switches between black and white to stay readable.
children (required)ReactNode
actionLabelstringText of the action button, for example "Undo".
onAction() => void
onDismiss() => void

ToastItem

PropTypeDescription
id (required)number
message (required)string
duration (required)numberMilliseconds before it closes by itself. Use 0 to keep it until dismissed.

ToasterProps

PropTypeDescription
toasts (required)ToastItem[]
onDismiss (required)(id: number) => void
dismissLabelstringAccessible name of the close button of every toast.
positionToasterPositionCorner of the screen. Use a top one if the toasts hide the buttons at the bottom of a dialog.
classNamestringClasses for the container. They replace the ones of `position`.

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