Display UI

Toaster

Shows brief, non-intrusive notifications to inform users of actions, errors, or system feedback.

Installation

npx shadcn@latest add https://display-ui.vercel.app/r/Toaster

Usage

import { Button } from "@/registry/default/displayui/Button"
import { Toaster } from "@/registry/default/displayui/Toaster"
<Toaster.Main>
  <Toaster.Trigger
    message="Profile updated successfully!"
    toastType="info"
    position="top-right"
  >
    <Button variant="solid" size="sm" className="bg-blue-500 hover:bg-blue-600">
      Primary
    </Button>
  </Toaster.Trigger>
</Toaster.Main>

API

Separator Props

For Toaster Main

AttributeTypeDescriptionDefault
childrenReactNode | ReactNode[]Wraps the application and provides toast context. Required for using Toaster.Trigger or useToast hook.-

For Toaster Trigger

AttributeTypeDescriptionDefault
childrenReactNodeContent rendered inside the trigger button.-
messagestringMessage text displayed inside the toast notification.-
toastType"success" | "error" | "info" | "warning"Controls the visual style and icon of the toast."info"
position"top-right" | "top-left" | "bottom-right" | "bottom-left"Defines where the toast appears on the screen."top-right"
durationnumberTime in milliseconds before the toast automatically disappears.3000
classNamestringAdditional CSS classes to customize the trigger button styling.-

Examples

Default

Warning

Success

Danger

Credits

This component is inspired by Rehman Kalawant Design Shared On Github.

On this page