Banner
Your trial ends in 3 days
Add a payment method to keep your rooms and rates.
npx shadcn add @klarhimmel/bannerCopy for AIExamples
Tones
Actions
Form
DetailsAbout, usage, props and more
An inline message in the page flow: information, a notice or an error, with an optional next step.
When to use
Use for
A message about the page or form it sits in, such as a notice or a failed save.
Not for
A confirmation that can vanish. Use a Toast.
Pairs with
Button, Text link, forms.
Preview
Booking confirmed
Your table at Exempelhotellet is reserved for Friday at 19:00.
Scheduled maintenance
The booking system is read-only on Sunday between 02:00 and 03:00.
Payment failed
The card was declined. Check the number or try another card.
Import
Import
- Files
- banner.tsx, in components/klarhimmel/ui/. With it: icon-button, theme, utils. npm: lucide-react.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tone | 'info' | 'neutral' | 'error' | 'info' | Error is announced at once (role=alert); the others wait (role=status). |
title | ReactNode | - | A short bold line. |
children | ReactNode | - | The message. |
action | ReactNode | - | A Button or TextLink for the next step. |
onDismiss | () => void | - | Shows a close button. |
dismissLabel | string | 'Dismiss' | Accessible name of the close button; pass it translated. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Moves to the action and the close button |
Enter / Space | Activates the focused button |
An error banner is announced at once; the others are announced politely.
Accessibility