Announcement bar
One line of news across the top or bottom of the page, with a link and a close.
Fieldwork 4.0 is here: docs, plans, and cycles in one place
Installation
npm i @uisatin/uiimport { AnnouncementBar } from '@uisatin/ui/announcement-bar'About 27.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/announcement-bar.jsonAdds announcement-bar.tsx, banner.tsx, banner-mesh.tsx, button.tsx, labels.tsx and spinner.tsx to components/ui and installs iconoir-react.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The AnnouncementBar component is a full-width bar for one line of news across the top or bottom of the page, with a link to read more and an optional close.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
action | { label, href?, onClick? } | — |
onDismiss | () => void | — |
dismissLabel | string | "Dismiss announcement" |
tone | "primary""inverse""default" | "primary" |
background | "plain""mesh" | "plain" |
shimmer | boolean | false |
sticky | "top""bottom" | — |
className | string | — |
ref | Ref<HTMLDivElement> | — |
...props | ComponentProps<'div'>Other attributes go to <div> | — |
Accessibility
A region named "Announcement" (pass aria-label to change it). It is not a live region, so it is not read out when it appears. The close button is named "Dismiss announcement" (dismissLabel); an action with href renders as a link. The mesh images are hidden from screen readers.
Something wrong or missing on this page?
Report a problemSuggest an improvement