Alert
A message in the page, with an icon for its type, a title, a description and actions. One that opens or closes after the page has loaded makes room as it goes, and a change of type rolls its icon to the next.
Examples
Types
Each type has its own icon, so it reads without its colour: info, and success, warning and error, which take the success, warning and destructive tints.
Actions
Buttons or links go under the description in AlertActions.
Close button
showCloseButton adds a button that closes it. It shrinks away and what is below moves up; opened again, it grows back.
Changing type
A new type rolls the icon to the next, so the loading spinner turns into the result, and the box glides to the new text’s height.
Installation
npx shadcn@latest add https://kinoui.com/r/alert.json- Files
components/kino/spinner.tsxlib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxlib/notice.tsxlib/controllable.tscomponents/kino/button.tsxcomponents/kino/alert.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Alert
Data attributes
Accessibility
- It is a live region from the start, so what it says when it opens, or when its text changes, is read out: an
erroras an alert, at once, and any other type as a status. What it says as the page loads is read where it sits, never announced. - To announce a message that arrives later, render the alert closed and open it, rather than adding it, so the region is there before its text.
- Its type never relies on colour alone: each one has its icon, and the title says what happened. The icon is hidden from screen readers.
- The close button is named Close. Once the alert has gone, Tab carries on from where it was.
- In forced colours it keeps an outline, so its edge still shows.