Skip to Content
✨ QuickCode UI keeps growing! More components, more features, and more ways to make your projects shine. Stay tuned & maybe… hire me or sponsor me 😉 
DocumentationToast

Toast

A notification system that displays brief messages to users with support for multiple types, positions, and custom configurations.

Install Dependencies

npx
quickcode-ui add Toast

Examples

Default one

All Position

Custom Config

ToastProvider Props

PropTypeDefaultDescription
childrenReactNodeChild components
position?'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right''top-right'Position where toasts appear
config?{ success?: { icon?: Icon, className?: string }, error?: { icon?: Icon, className?: string } }{}Custom configuration for toast types
maxToasts?5 | 10 | 1510Maximum number of toasts
className?'custom-class'''Additional CSS classes

useToast Hook

MethodReturnsDescription
success({ title: 'Success!' })stringShow success toast
error({ title: 'Error!' })stringShow error toast
warning({ title: 'Warning!' })stringShow warning toast
info({ title: 'Info!' })stringShow info toast
dismiss('toast-id')voidDismiss specific toast
dismissAll()voidDismiss all toasts

ShowToastOptions

PropExample ValueDefaultDescription
title'Order confirmed!'Toast title
description?'Your order has been placed'Optional description
duration?3000 | 5000 | 04000Auto-dismiss time in ms
showCloseButton?true | falsetrueShow close button
position?'top-left' | 'bottom-right'Override position
icon?CheckCircle | AlertTriangleCustom icon component
className?'bg-green-500 text-white'Custom CSS classes

Config Object

KeyExample ValueDescription
success{ icon: Heart, className: 'bg-green-500' }Success toast config
error{ icon: Zap, className: 'bg-red-500' }Error toast config
warning{ icon: Bell, className: 'bg-yellow-500' }Warning toast config
info{ icon: Info, className: 'bg-blue-500' }Info toast config
Last updated on