Install
Pull Toast from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Toast } from "@brika/clay";import { Toast } from "@brika/clay/components/toast";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
'use client';
import { Button } from '@brika/clay/components/button';
import { toast } from '@brika/clay/components/toast';
/** Trigger a basic notification, mount one Toaster near the app root first. */
export default function ToastDefaultDemo() {
return (
<Button
onClick={() =>
toast('Changes saved', {
description: 'Your project was saved successfully.',
})
}
>
Show toast
</Button>
);
}Toast, every way
Accessibility
- Built on Sonner's
aria-liveregion, announcements fire automatically. - Auto-dismiss duration defaults to 4 s; override via
toast(msg, { duration })for critical messages. - Action buttons inside toasts should have descriptive
labeltext. - Respects
prefers-reduced-motion, animations are skipped for users with motion sensitivity.
Theme tokens
Every CSS variable Toast reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Toast
without touching component code.
Toast tokens
3 tokens--toast-radiusradiusvar(--radius-container)components.toast.radiusToast corner radius.
--toast-shadowshadowvar(--shadow-spotlight)components.toast.shadowToast elevation.
--toast-backdrop-blurblur0pxcomponents.toast.backdropBlurBackdrop blur on the toast surface. Set non-zero for a frosted-glass toast.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.toast, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"toast": {
"radius": "var(--radius-container)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-toast-…) — see the
chips on each token row.
API reference
Props specific to Toast. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
No wrapper-specific props, all attributes pass through to the underlying primitive.