Short notifications in the corner. Several stack up with the newest in front and spread out on hover or focus. A swipe sideways dismisses one; they pause while hovered, can carry one action, and are read out politely.
Used for
- Saved confirmation
- Undo a delete
- Run finished
- Copy done
Examples
Installation
npx knowns-ui@latest add toastFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Toast from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/toast
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add toast
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/toast.tsx
- components/ui/knowns/toast-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/toast, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "toast" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- title
ReactNode- Main line.
- description
ReactNode- Muted second line.
- tone
"neutral"|"success"|"warning"|"danger"- Default
"neutral" - Colour of the leading dot.
- action
{ label, onClick }- One button; clicking it also dismisses the toast.
- duration
number- Default
4500 - ms before it hides; hovering pauses.
| Prop | Type | Default | Description |
|---|---|---|---|
| title | ReactNode | - | Main line. |
| description | ReactNode | - | Muted second line. |
| tone | "neutral" | "success" | "warning" | "danger" | "neutral" | Colour of the leading dot. |
| action | { label, onClick } | - | One button; clicking it also dismisses the toast. |
| duration | number | 4500 | ms before it hides; hovering pauses. |
What it handles
- 01Mounts one ToastProvider and gives every component a toast function through useToast, which throws if the provider is missing.
- 02Takes a title, a description, a tone of neutral, success, warning or danger, and one action such as Undo that runs and then removes the toast.
- 03Hides each toast after duration (4.5 seconds by default), and pauses the timer while the pointer is over it, then re-arms it for a short grace after leaving.
- 04Keeps at most four on screen in a stack at the bottom right, dropping the oldest when a new one arrives.
- 05Announces through an aria-live polite list, with a Dismiss button on each toast.
- 06Plays an exit before removing a toast, so it leaves the stack instead of vanishing.
States
- First render
- Nothing. The stack is empty until a toast is raised
- none
- Toast arrives
- It fades in rising from 4px below
- 180ms, ease out
- Toast leaves
- It fades and sinks 4px, then leaves the list
- 120ms, ease out
- Hover
- The hide timer pauses and nothing moves
- none
- Reduced motion
- It appears and leaves at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The stack is empty until a toast is raised | none |
| Toast arrives | It fades in rising from 4px below | 180ms, ease out |
| Toast leaves | It fades and sinks 4px, then leaves the list | 120ms, ease out |
| Hover | The hide timer pauses and nothing moves | none |
| Reduced motion | It appears and leaves at once | 0ms |
Works with
When to use
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Toast to my app and wire it to my own data.
- I need brief confirmations and background results such as Saved or Run finished, with an optional action. Set that up with the Knowns UI Toast.
- Which Toast props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "toast" }) and search_docs({ query: "toast" }).