Pill Toast
betaA compact pill toast that drops in from above with a blur and a slight overshoot, then dismisses itself upward.
- Feedback
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add pill-toastnpm packages installed: class-variance-authority.
import { PillToast } from "@/components/ui/pill-toast";Default
Demo
Static
<PillToast>
| Prop | Type | Default |
|---|---|---|
children (required)The message. | ReactNode | — |
defaultOpenInitial open state when uncontrolled. | boolean | false |
durationHow long it stays, in milliseconds, before dismissing itself. | number | 2000 |
iconThe glyph in the accent disc. Defaults to a tick. | ReactNode | — |
onOpenChangeCalled when it opens or auto-dismisses. | (open: boolean) => void | — |
openControlled open state. Reopen it (false, then true) to show it again. | boolean | — |
pillClassNameClasses for the pill itself (the root is the live region around it). | string | — |
size | "sm" | "md" | "lg" | "md" |
Plus every attribute of <div> except children.
The root is an always-mounted polite live region (role="status", aria-atomic) and the message is inserted when the toast opens, so screen readers announce it once without interrupting. The icon is aria-hidden; the text carries the meaning. Hovering or focusing the pill holds the auto-dismiss timer, and `duration={Infinity}` keeps it until you close it. It is not a place for actions or anything the user must act on: use toast or alert for that. Under reduced motion the pill appears and disappears without the drop, blur or overshoot.
7/7
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — does not apply
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes