Overview
Banner lays out caller-provided content, an optional icon node and an optional action node. status describes feedback meaning: neutral, info, success, warning or error. variant selects solid or soft appearance. An explicit color overrides the status palette without changing its meaning.
Defaults are status="info" and variant="solid". The default status palettes are gray, blue, green, orange and red, respectively.
Usage
Actions and appearance
Banner.Action provides a small outline button that inherits the banner’s displayed color, including explicit palette overrides and solid appearances. It supports Button interactions, links, refs and custom rendering. The action slot also accepts arbitrary controls.
The root target is a div. Native attributes, event handlers, className, style and ref apply to that root. render accepts a Base UI element or callback; the callback receives native props and ref plus resolved status, variant and color state. Preserve the supplied props and ref when composing another element.
role, aria-live or announcements. Choose them at the caller when updates should be announced. Supply accessible names for controls and mark decorative icon nodes with aria-hidden. The caller owns visibility and dismissal.
Dismissal
PassonDismiss to show a 24px ghost close control at the logical inline end. The control inherits the banner color and has type="button". closeLabel defaults to Close; supply localized text in your application. Balanced inline spacing keeps centered content and actions clear of the control.
The caller owns visibility. Activating the close control calls onDismiss and leaves the banner mounted until its caller updates state. Other actions remain in the action slot.
Migration
Replacevariant="primary" with variant="solid" and variant="secondary" with variant="soft". Replace color="danger" with status="error", or color="red" when only the palette should change. Blue information banners can use status="info".
Props
Optional trailing ReactNode. Banner.Action supplies a small outline action that inherits the resolved banner color; arbitrary controls are also accepted.
Accessible label for the close control. Defaults to Close; supply localized text when needed.
Palette override: gray, blue, green, orange or red. When omitted, status selects the corresponding palette.
Renders a 24px ghost close control and calls this callback when activated. The caller owns visibility.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, BannerState>
Base UI element or render callback. The callback receives native props/ref and resolved status, variant and color state.
Feedback meaning: neutral, info, success, warning or error. Defaults to info. Does not assign a role or live region.
Solid or soft appearance. Defaults to solid, independently of status.
Banner.Action
CSS class applied to the element, or a function that
returns a class based on the component’s state.
Destination URL. Renders a native anchor when
render is omitted unless nativeButton is explicitly true. Custom renderers retain their own element contract.Where the loading indicator appears.
center hides the content while preserving its layout space; start and end keep children and the opposite icon visible and replace the corresponding icon with the spinner.Whether the rendered root is a native button. Defaults to true for custom renderers. The built-in
href anchor defaults to false; an explicit value takes precedence.ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>
Caller-supplied root element or renderer. Native attributes, handlers, event details, and refs reach the rendered root. Use
nativeButton={false} and role="link" for a custom navigation anchor. Router integration belongs to the caller.Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens.