Maya Chen replied to your comment
Looks good, ship it on Thursday.
A card for something the app did or heard about, with a picture, a badge and a close on its corner.
Maya Chen replied to your comment
Looks good, ship it on Thursday.
npm i @uisatin/uiimport { Notification } from '@uisatin/ui/notification'About 14.7 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/notification.jsonAdds notification.tsx, badge.tsx and labels.tsx to components/ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
The Notification component is an article named by its title, with a picture on the left, a title and description, a badge on the right, optional cards stacked behind and a close button on its top-right corner. Several go in a NotificationStack, newest first, each with a key: it folds them into a pile and unfolds them on hover, focus or a tap (expanded keeps it open); a removed one fades out while the rest move up.
| Prop | Type | Default |
|---|---|---|
title | ReactNode | — |
description | ReactNode | — |
media | ReactNode | — |
badge | ReactNode | — |
stacked | 012 | 0 |
onDismiss | () => void | — |
dismissVisibility | "hover""always" | "hover" |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<'article'>Other attributes go to <article> | — |
An article named by its title and described by its description; the media and the cards stacked behind are hidden from screen readers unless the media names itself (an Avatar with name). It is not a live region: announce a new notification from the app, or use Toast. The close button is a 24px button named "Dismiss" (dismiss in SatinLabels); it shows on hover and whenever focus is inside the card, and on touch screens always.
| Key | Action |
|---|---|
| EnterorSpace | On the close button, dismisses the notification. |
| Tab | In a NotificationStack, moving focus into it unfolds it; then Tab goes through every card’s close button. Folded, the cards behind are inert and hidden from screen readers. |
Something wrong or missing on this page?
Report a problemSuggest an improvement