Skip to content
Feedback

Toaster

Mount `Toaster` once in your root layout, then call `toast()` from anywhere — including outside a component, since the queue is plain state rather than context.

import
import { Toaster, toast } from '@joshicodes/cock';

Toasts

Toaster itself is mounted once in the root layout; this page already has one.

Behaviour

  • `duration: 0` keeps a toast until it is dismissed, which is what you want for an error with a retry action.
  • `toast()` returns an id that `toast.dismiss(id)` takes.

API

Read out of the component sources at build time, so it matches the version you installed. Every component also takes class, merged through tailwind-merge so your utility wins.

Props of Toaster

PropTypeDefault
position
'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right''bottom-right'
class
string—

See also

cock. Yes, it stands for core component kit. We checked twice.