Toast Categories
Basic Toasts
basicDefault Toast
toast('This is a basic toast message')Toast Types
typesSuccess Toast
toast.success('This is a success toast', {
description: 'Your action was completed successfully',
})Error Toast
toast.error('This is an error toast', {
description: 'Something went wrong',
duration: 8000, // 8 seconds
})Warning Toast
toast.warning('This is a warning toast', {
description: 'Please be careful with this action',
duration: 3000, // 3 seconds
})Info Toast
toast.info('This is an info toast', {
description: "Here's some information for you",
duration: Number.POSITIVE_INFINITY, // Won't disappear until closed
})Duration Options
durationShort Duration (2s)
toast('Short duration toast', {
description: 'This toast will disappear quickly',
duration: 2000, // 2 seconds
})Long Duration (10s)
toast('Long duration toast', {
description: 'This toast will stay visible for longer',
duration: 10000, // 10 seconds
})Permanent Toast
toast.info('This is a permanent toast', {
description: "This toast won't disappear until closed",
duration: Number.POSITIVE_INFINITY,
})Customization Options
customizationCustom Toast Options
The Sonner toast library supports various customization options:
- Custom icons and styling
- Different positions (top-right, top-center, etc.)
- Custom CSS classes
- Rich content with JSX
- Custom close buttons
toast('Custom toast', {
description: 'With custom styling and options',
icon: <CustomIcon />,
position: 'top-center',
className: 'my-custom-toast',
})