Component libraryAlert
Alert
FreeInline notices with icons, actions and optional dismissal.
npx shadcn@latest add https://tidalui.com/r/alert.jsonInstallation
Terminal
Import components/ui/tidal.css, components/ui/alert.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
TidalAlert requires a visible title (ReactNode), with optional children for message content. tone: neutral(default), success, warning or error; icons, border treatment and text distinguish states without color. icon overrides the decorative default, or false removes it. action accepts caller-owned nodes. Use className='tidal-alert-action' on a native link to receive the supported44px action styling; arbitrary custom nodes remain caller-styled. TidalAlertAction forwards native button attributes/events/ref and defaults to type=button, with explicit type=submit for forms. Root forwards native div attributes/style/dir/className/ref. announce defaults off for static notices; polite adds role=status/aria-live=polite and assertive adds role=alert/aria-live=assertive to the message only, with aria-atomic=true. Actions and dismissal stay outside this live message. Use assertive only for urgent new feedback, and avoid competing live regions. Initial page-load messages are not guaranteed announcements. Nonempty visible title and meaningful description/action labels are consumer responsibilities. Optional onDismiss receives the native button click; dismissLabel defaults Dismiss notice and dismissDisabled disables that button. The consumer owns visibility, validation, action effects and focus return after removing a focused notice. The component never steals focus, disappears on a timer, stores data or performs a request. Native Action/Dismiss controls are44px, wrap long text, retain visible contrast-safe focus, and reflect disabled state. Scoped tidal.css/alert.css provide finite entry, coordinated icon/check transitions and reduced-motion handling. No hidden state or automatic dismissal.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.