Banner
Overviewimport { Banner, BannerAction } from '@nili/ui';This is the library’s own overview page, rendered live. Switch the language or the theme in the header and it follows.
Statuses
The same five meanings as Alert. A banner is usually on screen at first paint, so it is announced politely by default.
import { Banner } from "@nili/ui"
export function Example() {
return (
<>
<Banner status="error" title="Payment failed." />
<Banner status="warning" title={t('content.maintenance')} />
<Banner status="success" title={t('content.verified')} />
<Banner status="info" title="We updated our terms." />
<Banner status="feature" title={t('content.feature')} />
</>
)
}Appearances
Four treatments, matching Alert.
import { Banner } from "@nili/ui"
export function Example() {
return (
<>
<Banner appearance="filled" status="info" title="Filled" />
<Banner appearance="light" status="info" title="Light" />
<Banner appearance="lighter" status="info" title="Lighter" />
<Banner appearance="stroke" status="info" title="Stroke" />
</>
)
}Description, action and dismissal
description is appended after the title, separated by a dot. Banner takes a single inline action, per the design — if you need two, you want an Alert.
import { Banner, Icon } from "@nili/ui"
import { RiSparkling2Line } from "@remixicon/react"
export function Example() {
const [open, setOpen] = useState(true)
if (!open) return null
return (
<Banner
status="feature"
appearance="light"
title="Smart filters are here."
description="Save a filter set and reuse it everywhere."
icon={<Icon icon={RiSparkling2Line} />}
action={{ label: "Take a look", href: "#" }}
dismissible
dismissLabel={t('close')}
onDismiss={() => setOpen(false)}
/>
)
}Sticky
sticky pins the banner to the top of the viewport. Right for a page-level announcement; wrong for one inside a card.
import { Banner } from "@nili/ui"
export function Example() {
return (
<Banner
sticky
status="info"
title={t('sticky.archive')}
/>
)
}Banner
extends Omit< ComponentPropsWithoutRef<'div'>, 'title' | 'children' >
Variant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| status | error | warning | success | info | feature | info | |
| appearance | filled | light | lighter | stroke | filled | Named `appearance`, not `style`, so React's own `style` prop stays usable. |
Other props
| Prop | Type | Default | Notes |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| title* | ReactNode | — | |
| description | ReactNode | — | Shown after the title, separated by a `∙`. |
| icon | boolean | ReactNode | true | `true` uses the default glyph for `status`; a node overrides it; `false` hides it. |
| action | BannerAction | — | Single inline link, per the Figma spec. |
| dismissible | boolean | false | |
| onDismiss | () => void | — | |
| dismissLabel | string | Dismiss | Accessible name for the close button. Required by `dismissible`. |
| sticky | boolean | false | Pins the banner to the top of the viewport. A page-level banner usually wants this; one rendered inside a card does not. |
| urgency | assertive | polite | off | polite | How assistive tech announces the banner. Defaults to `'polite'` — unlike Alert, a banner is almost always present on first paint rather than appearing in response to an action, so interrupting is wrong. Use `'assertive'` only when the banner appears mid-session. |
BannerAction
Variant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| appearance | filled | light | lighter | stroke | filled |
BannerDismiss
internalVariant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| appearance | filled | light | lighter | stroke | filled |
BannerIcon
internalVariant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| status | error | warning | success | info | feature | info | |
| appearance | filled | light | lighter | stroke | filled |