Alert
A persistent message that helps people recover or continue.
npx shadcn@latest add @silicon-ui/alertInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/alertManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/alert/alert.tsx
- components/silicon-ui/alert/alert.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
title* | string | — |
tone | AlertTone
| — |
children | ReactNode | — |
openControls presence. Hiding the alert collapses its height and fades it out. | boolean | — |
onDismissShows a dismiss button. An uncontrolled alert collapses first, then calls this. | () => void | — |
Also accepts the props of HTMLAttributes<HTMLDivElement>.
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens