Skip to content
loseta

Components / Feedback

Toast

A fixed stack of transient notifications.

Status stableWorks with button

Saved

Your changes have been saved.

<div style="display: flex; flex-direction: column; gap: 0.5rem; max-width: 22rem">
  <div class="toast" role="status">
    <section>
      <p data-slot="title">Saved</p>
      <p data-slot="description">Your changes have been saved.</p>
    </section>
    <button type="button" class="btn" data-variant="ghost" data-size="icon-xs" data-slot="close" aria-label="Dismiss">×</button>
  </div>
  <div class="toast" data-variant="destructive" role="alert">
    <section>
      <p data-slot="title">Upload failed</p>
      <p data-slot="description">The file is larger than 10 MB.</p>
    </section>
    <button type="button" class="btn" data-variant="ghost" data-size="icon-xs" data-slot="close" aria-label="Dismiss">×</button>
  </div>
</div>

Installation

pnpm dlx loseta add toast
npx loseta add toast

Accessibility and behavior

  • Wrap toasts in .toaster for fixed positioning. Items use role="status" or role="alert"; timing and dismissal are consumer JavaScript. Sonner is a compatibility note, not a registry item; keep the toast markup and add Sonner in consumer code when you need its queue.

Files

components/toast.cssbase
styles/nova/toast.cssstyle

Install contract

The CLI writes the base file under components/, the visual file for the selected style under styles/<name>/, and any primitive dependency underprimitives/. The generated index.css imports them in the right layer order.

← Back to components

loseta is MIT licensed. Built with native CSS, no runtime. Inspired byshadcn/ui.