Alert
A message that stays on the page until it is dealt with: info, success, warning or error.
Two people are editing this page
Installation
npm i @uisatin/uiimport { Alert } from '@uisatin/ui/alert'About 15.6 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/alert.jsonAdds alert.tsx, button.tsx, labels.tsx and spinner.tsx to components/ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The Alert component is a div with role="alert" (errors and warnings) or role="status" that shows a status icon, a title, a description, an action and a close button.
| Prop | Type | Default |
|---|---|---|
intent | "neutral""info""success""warning""error" | "neutral" |
variant | "soft""outline" | "soft" |
layout | "block""inline" | "block" |
title | ReactNode | — |
description | ReactNode | — |
icon | booleanReactNode | true |
action | ReactNode | — |
onDismiss | () => void | — |
className | string | — |
ref | Ref<HTMLDivElement> | — |
...props | ComponentProps<'div'>Other attributes go to <div> | — |
Accessibility
Errors and warnings are role="alert", so screen readers read them out when they appear; the other intents are role="status", read politely. The status icon is hidden, so say the severity in the title when it matters. The close button is named "Dismiss" (dismiss in SatinLabels).
Something wrong or missing on this page?
Report a problemSuggest an improvement