Information Banner
⋯
InformationBanner renders the Figma Information Banner set: a title, supporting text, an optional
row of additional information, and an optional close button. variant selects Basic, Gradient, or
Soft, and color selects one of six accent colors.
import { InformationBanner } from "@nesra/ui/information-banner";
export function SavedNotice({ onDismiss }: { onDismiss: () => void }) { return ( <InformationBanner color="blue" onDismiss={onDismiss} variant="soft"> <InformationBanner.Title>Account updated successfully</InformationBanner.Title> <InformationBanner.Description> Your profile information has been saved. </InformationBanner.Description> <InformationBanner.Meta> <InformationBanner.MetaItem label="Updated by:">Michael Owen</InformationBanner.MetaItem> </InformationBanner.Meta> </InformationBanner> );}InformationBanner is also exported from @nesra/ui.
Composition
Section titled “Composition”InformationBanner├── InformationBanner.Title├── InformationBanner.Description└── InformationBanner.Meta └── InformationBanner.MetaItemEvery part is optional. The root adds the accent bar or icon and the close button.
Examples
Section titled “Examples”Variants
Section titled “Variants”basic: a neutral card with a 5px accent bar on the leading edge.gradient: a top-to-bottom gradient from the color’s subtle-hover role to its subtle role, with a 24px icon.soft: the color’s subtle fill with a 4px rounded accent bar.
import { InformationBanner } from "@nesra/ui/information-banner";
const variants = ["basic", "gradient", "soft"] as const;
export function InformationBannerVariantsExample() { return ( <div className="grid w-full gap-4"> {variants.map((variant) => ( <InformationBanner key={variant} onDismiss={() => {}} variant={variant}> <InformationBanner.Title>{`Account updated (${variant})`}</InformationBanner.Title> <InformationBanner.Description> Your profile information has been saved. Changes will be reflected immediately. </InformationBanner.Description> <InformationBanner.Meta> <InformationBanner.MetaItem label="Updated by:"> Michael Owen </InformationBanner.MetaItem> <InformationBanner.MetaItem label="Role:">Lead</InformationBanner.MetaItem> </InformationBanner.Meta> </InformationBanner> ))} </div> );}Colors
Section titled “Colors”color maps the Figma colors to lowercase values. Figma Teal Green is teal.
import { InformationBanner } from "@nesra/ui/information-banner";
const colors = ["blue", "yellow", "teal", "orange", "purple", "pink"] as const;
export function InformationBannerColorsExample() { return ( <div className="grid w-full gap-3 md:grid-cols-2"> {colors.map((color) => ( <InformationBanner color={color} key={color} variant="soft"> <InformationBanner.Title>{`Soft ${color}`}</InformationBanner.Title> <InformationBanner.Description>Changes are saved.</InformationBanner.Description> </InformationBanner> ))} {colors.map((color) => ( <InformationBanner color={color} key={color} variant="gradient"> <InformationBanner.Title>{`Gradient ${color}`}</InformationBanner.Title> <InformationBanner.Description>Changes are saved.</InformationBanner.Description> </InformationBanner> ))} </div> );}Icon and title badge
Section titled “Icon and title badge”icon replaces the Gradient info icon, and icon={null} hides it. Basic and Soft show the accent
bar instead and ignore icon. A Badge inside Title sits after the text with a 12px gap.
import { Badge } from "@nesra/ui/badge";import { InformationBanner } from "@nesra/ui/information-banner";import { Sparkles } from "lucide-react";
export function InformationBannerIconAndBadgeExample() { return ( <div className="grid w-full gap-4"> <InformationBanner color="purple" icon={<Sparkles />} variant="gradient"> <InformationBanner.Title> New insights are ready <Badge size="sm">Draft</Badge> </InformationBanner.Title> <InformationBanner.Description> Review the weekly summary before you share it. </InformationBanner.Description> </InformationBanner> <InformationBanner color="teal" icon={null} variant="gradient"> <InformationBanner.Title>Sync complete</InformationBanner.Title> </InformationBanner> </div> );}Dismissible
Section titled “Dismissible”onDismiss renders a transparent ghost icon button. The application removes the banner from its own
state and moves focus to a control that remains.
import { Button } from "@nesra/ui/button";import { InformationBanner } from "@nesra/ui/information-banner";import { useRef, useState } from "react";
export function InformationBannerDismissibleExample() { const [open, setOpen] = useState(true); const restoreRef = useRef<HTMLButtonElement>(null);
if (!open) { return ( <Button onClick={() => setOpen(true)} ref={restoreRef} variant="outline"> Show the notice again </Button> ); }
return ( <InformationBanner color="orange" onDismiss={() => { setOpen(false); // Move focus to a control that remains after the banner is removed. requestAnimationFrame(() => restoreRef.current?.focus()); }} variant="soft" > <InformationBanner.Title>Scheduled maintenance</InformationBanner.Title> <InformationBanner.Description> Reports are read-only on Sunday from 01:00 to 03:00. </InformationBanner.Description> </InformationBanner> );}Light and Dark
Section titled “Light and Dark”| Part | Basic | Gradient | Soft |
|---|---|---|---|
| Fill | Surface/card-bg-neutral |
Categorical/*/subtle-hover to Categorical/*/subtle |
Categorical/*/subtle |
| Border | Stroke/stroke-border |
Categorical/*/border |
Categorical/*/border |
| Accent | Bar Categorical/*/base |
Icon Categorical/*/foreground |
Bar Categorical/*/base |
| Title | Text/text-headline |
Text/text-headline |
Text/text-headline |
| Description, meta term | Text/text-secondary |
Text/text-secondary |
Text/text-secondary |
| Meta value | Text/text-body |
Text/text-body |
Text/text-body |
| Meta separator | Icon/icon-muted |
Icon/icon-muted |
Icon/icon-muted |
| Close button | Ghost, Action/tertiary-default, icon Icon/icon-neutral |
Same | Same |
The subtle, subtle-hover, border, and foreground roles change between modes. The base roles keep the same value.
Accessibility
Section titled “Accessibility”- The root is a
<section>. With aTitle, it is a region landmark named by the title. Without aTitle, it is a plain section. - The banner is not a live region. When the application inserts a banner to report the result of an
action, pass
role="status"so screen readers announce it politely. Metais a description list. EachMetaItemrenders itslabelas a term and its children as the description.- The close button is a native button named by
dismissLabelor the translatable “Dismiss” message. Translate it throughNesraI18nProvider. The application removes the banner and moves focus after dismissal. - The accent bar, icon, and separator dots are hidden from assistive technology. Do not rely on color to convey meaning. State it in the title or description.
API reference
Section titled “API reference”InformationBanner
Section titled “InformationBanner”| Prop | Type | Default | Effect |
|---|---|---|---|
variant |
"basic" | "gradient" | "soft" |
"basic" |
Selects the Figma variant. |
color |
"blue" | "yellow" | "teal" | "orange" | "purple" | "pink" |
"blue" |
Selects the accent color. |
icon |
ReactNode |
Info icon | Gradient only. null hides the icon. |
onDismiss |
(event: MouseEvent<HTMLButtonElement>) => void |
— | Renders the close button and calls the handler when it is pressed. |
dismissLabel |
string |
Translated “Dismiss” | Accessible name of the close button. |
Native section attributes, including role, className, and refs, are forwarded. The root has
data-variant and data-color.
InformationBanner.Title
Section titled “InformationBanner.Title”Semibold 14px title in text-headline. Renders a div and accepts native div props, className,
and a ref. Its id names the root region.
InformationBanner.Description
Section titled “InformationBanner.Description”Regular 14px supporting text in text-secondary. Renders a div and accepts native div props,
className, and a ref.
InformationBanner.Meta
Section titled “InformationBanner.Meta”Regular 12px row of additional information. Renders a dl and accepts native description-list
props, className, and a ref.
InformationBanner.MetaItem
Section titled “InformationBanner.MetaItem”| Prop | Type | Default | Effect |
|---|---|---|---|
label |
ReactNode |
Required | Term in text-secondary. Include any colon. |
children |
ReactNode |
— | Value in text-body. |
Renders a div around a dt and dd and accepts native div props, className, and a ref. Items
after the first are preceded by a 2px separator dot.
Prop types such as InformationBannerProps, InformationBannerVariant, and
InformationBannerColor are exported from @nesra/ui and @nesra/ui/information-banner. The
banner uses the Light and Dark semantic color roles, typography,
layout scale, and shape tokens.