NOCTA UI

Toast

Sonner-inspired toast notification system with CSS Transitions, smart stacking, and accessibility features

Installation

Install the Toast component using the nocta-ui CLI:

npx @nocta-ui/cli add toast

Import the components you need:

import { toast, Toaster } from '@/components/ui/toast';

Add the Toaster component to your app to enable toast notifications:

import { Toaster } from '@/components/ui/toast';

function App() {
  return (
    <>
      <YourApp />
      <Toaster />
    </>
  );
}

Examples

Default Toast

Variants

Positions

Click the buttons to see toasts appear in different positions:
Available positions: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right

Toast with Actions

Stacked Toasts

Persistent Toast

Custom Duration

Dismiss All

Default String Usage

toast('Simple message');
toast.success('Operation successful!');
toast.warning('Please be careful');
toast.error('Something went wrong');

Api Reference

Prop

Type