Skip to content
satin

Notification

A card for something the app did or heard about, with a picture, a badge and a close on its corner.

MC

Maya Chen replied to your comment

Mention

Looks good, ship it on Thursday.

Installation

Terminal
npm i @uisatin/ui
Import
import { 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.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

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.

PropTypeDefault
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>

—

Accessibility

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.

KeyAction
EnterorSpaceOn the close button, dismisses the notification.
TabIn 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.