# Notification

Supply UI 1.1.0. On top of the page, part of `Notifications`.

Things that happened and stay until read: a list in a `Popover` under a bell (an icon `Button` with a `Count` inside), or on a page of its own. Class `ui-notifications` > `ui-notification` + `data-unread`; panel `ui-popup ui-notifications-panel`

One notification. `children` is the sentence under the title.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `title` (needed) | `ReactNode` |  | What happened: "New booking". |
| `actions` | `ReactNode` |  | Buttons under the text: "Accept", "View". |
| `media` | `ReactNode` |  | In front of the text: an <Avatar>, a <PatternAvatar> or an icon in a tile. |
| `time` | `ReactNode` |  | When it happened: "2 min ago", "Yesterday 18:00". |
| `unread` | `boolean` |  | Not read yet: shows a dot. |

It also takes the 280 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/button.css`, `components/card.css`, `components/lists.css`, `components/icons.css`, `components/input-group.css`, `components/small-things.css`, `components/button-group-toggle.css`, `components/chip-you-can-remove.css`, `components/collapsible.css`, `components/rating.css`, `components/carousel.css`, `components/banner.css`, `components/scroll-area-ratio-divider.css`, `components/table-sorting-chosen-rows.css`, `components/tab-bar.css`, `components/checklist.css`, `components/pick-tiles.css`, `components/prose.css`, `components/burger.css`, `components/carousel-arrows.css`, `components/page-transitions.css`, `parts/collapsible.css`, `parts/rating.css`, `parts/carousel.css`, `parts/scroll-area.css`, besides the ones every page loads.

## On top of the page: notes

**States.** Closed, opening (fades and rises), open, closing (fades before what it changed appears: `afterClose`). While open, focus is inside and Escape closes it; when it closes, focus goes back to what opened it.

**Do**
- Name every dialog, drawer and popover (`DialogTitle`, `DrawerTitle`, or `aria-label`).
- Use `AlertDialog` for anything that cannot be undone, with the action named on its button ("Delete 3 files").
- Use a `Drawer` on a phone for what a `Popover` does on a computer.

**Don't**
- Don't open a dialog from a dialog; change what the open one shows instead.
- Don't put the only way to do something in a right-click menu or a tooltip.
- Don't use a toast for something the person must not miss: that is an `Alert` on the page.
