Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Banner

A dismissible application-wide message.

Preview

Live preview

Changes apply to this preview only.

Your workspace is on the Pro plan

The upgrade is active for every member, with no restart required.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Each tone tints the whole surface and colours the icon.

Open preview

sticky keeps the banner at the top of its scrolling container; the page shell provides the offset in a real app.

Open preview

A banner belongs to the page shell, above the content it qualifies.

Open preview

Usage

Keep persistent critical notices discoverable after dismissal and store dismissal preferences deliberately.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluBannerProps

Type source
PimoluBannerProps public API
NameTypeDefaultDescription
variant"neutral" | "success" | "warning" | "danger" | "info" | undefined"info"Semantic tone of the page-level message.
titleRequiredReactNode—Short, emphasised summary.
descriptionReactNode—Optional supporting text.
actionsReactNode—Action buttons or links rendered below the description.
dismissibleboolean | undefinedtrue when onDismiss is providedShows an accessible close button. Defaults to true when onDismiss is provided. The component is controlled: hide it when the callback fires.
onDismiss(() => void) | undefined—Public Pimolu prop; see the source declaration for details.
dismissLabelstring | undefined"Dismiss banner"Accessible name of the close button.
iconReactNode—Decorative leading icon, hidden from assistive technology.
stickyboolean | undefinedfalseSticks the banner to the top of its scrolling container.
roleAriaRole | undefined"alert" for danger and "status" for every other variantExplicit landmark role. Defaults to "alert" for danger and "status" for every other variant.
onChangeChangeEventHandler<HTMLDivElement, Element> | undefined—Standard React/HTML attribute.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
onClickMouseEventHandler<HTMLDivElement> | undefined—Standard React/HTML attribute.
variant

"neutral" | "success" | "warning" | "danger" | "info" | undefined

Default: "info"

Semantic tone of the page-level message.

titleRequired

ReactNode

No default extracted.

Short, emphasised summary.

description

ReactNode

No default extracted.

Optional supporting text.

actions

ReactNode

No default extracted.

Action buttons or links rendered below the description.

dismissible

boolean | undefined

Default: true when onDismiss is provided

Shows an accessible close button. Defaults to true when onDismiss is provided. The component is controlled: hide it when the callback fires.

onDismiss

(() => void) | undefined

No default extracted.

Public Pimolu prop; see the source declaration for details.

dismissLabel

string | undefined

Default: "Dismiss banner"

Accessible name of the close button.

icon

ReactNode

No default extracted.

Decorative leading icon, hidden from assistive technology.

sticky

boolean | undefined

Default: false

Sticks the banner to the top of its scrolling container.

role

AriaRole | undefined

Default: "alert" for danger and "status" for every other variant

Explicit landmark role. Defaults to "alert" for danger and "status" for every other variant.

onChange

ChangeEventHandler<HTMLDivElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

onClick

MouseEventHandler<HTMLDivElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Choose announcement urgency carefully and give the dismiss action a clear name.
Read the accessibility guide →