Banner

View as Markdown

A band across the top about the whole product, such as a trial ending, with one action.

Scheduled maintenance Sunday, 02:00–03:00 UTC.Sync pauses for up to 20 minutes. Nothing is lost.

Your trial ends in 3 days.

Choose a plan

Your last payment failed.Update the card ending 4242 to keep your workspace active.

When to use

A band across the top about the whole product, such as a trial ending, with one action. Use Alert instead when the message is about one part of the page.

Usage

import { Banner } from "./ui/uicontext/components/Banner.ts"
const Message = UiSchema.TaggedEnum({ DismissedNews: {} })export const News = (h: Html.H<typeof Message.Type>) =>	Banner(h, { tone: "info", title: "Exports now include comments.", action: { label: "See what's new", href: "/changelog" }, onDismiss: Message.DismissedNews() })

Examples

Across the top of an app

Without inset it's a band, edge to edge. A state that still holds has no dismiss.

Editing is paused while we fix a database issue.You can still read everything.

Status page
Northwind · Docs
Q3 launch plan

API reference

Options

Banner options
NameTypeDefaultDescription
tone"neutral" | "info" | "warning" | "danger"NeutralNeutral by default; danger for something broken that needs action now
titlerequiredstring—What's happening, in one short sentence: "Your trial ends in 3 days."
bodystring | View.Content—More, when it helps: "Scheduled maintenance Sunday 02:00–03:00 UTC."
actionBannerAction<Message>——
onDismissMessage—Leave it out while the state still holds (a failed payment); give it for news.
insetboolean—A card inside a page instead of a band across the top.
labelstring"Announcement"The landmark's name; "Announcement" by default.
styleStyle——

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/banner

Source