Sticky Banner
Dismissible announcement bar pinned above the header.
- 1.2 KB gzipped
- Zero dependencies
- Reduced-motion safe
- Base UI & Radix compatible
Preview
Velora 0.4 is out — 64 components
Installation
pnpm dlx shadcn@latest add https://paulkeys.org/r/sticky-banner.jsonAdds components/velora/sticky-banner.tsx and merges the keyframes and tokens into your CSS.
Props
| Prop | Type | Default |
|---|---|---|
dismissibleHide the dismiss button for banners that must stay put | boolean | true |
onDismissCalled after the banner is dismissed; focus has already moved to the next focusable element | () => void | — |
children* | React.ReactNode | — |
Also accepts every <div> attribute, forwarded to the root element.
Accessibility
- Reduced motion
- Nothing animates, so reduced-motion users see the same banner.
- Keyboard
- The dismiss button is a native button with a visible focus outline. Dismissing moves focus to the next focusable element after the banner.
- Screen readers
- The dismiss button is named "Dismiss announcement"; the banner itself is a plain div with no landmark role.