shadcn.io is not affiliated with official shadcn/ui
Collapsible Details Banner Block for React
An incident notice for a status-page product as a disclosure: one summary line with an Investigating badge, and open it explains the incident and lists the four affected services.
Installation
Overview
An incident banner for React with Base UI, for bad news that most visitors only need a line of. A card sits between the page's solid rails with one summary line: a warning dot, "Elevated error rates in US-East", an Investigating badge and a chevron, and the whole line is the trigger. Opened, it says how long ago the incident started, counted from the visit, explains what is affected, and lists the four services on shared hairlines, each with its state in words as well as a dot, then links to the status page. The height opens on one grid row with a CSS transition. It's built from Collapsible, Status, Badge, Relative Time Text and Guides, and it follows the theme.
FAQ
How do I change the services?
Edit SERVICES at the top of the file: each entry is a name and degraded, true for a warning dot and "Degraded", false for a foreground dot and "Operational". The state is always written as well as drawn, so it doesn't depend on colour. A list of four fills the two-by-two grid; for more, let it grow rows, and keep the open banner under about 430 pixels.
How does it say how long ago the incident started?
STARTED_AGO_MS sets it as a duration, and the block adds it to the moment the page first runs in the browser, so it says "32 minutes ago" when you arrive and keeps counting, and it never shows a calendar date that goes stale. Until the browser runs, the server's page says "Started recently". In your product, pass the incident's real start time to Relative Time Text instead.
How is the disclosure named for screen readers?
The trigger is a button inside the block's heading (h2), so the heading lists the banner among the page's headings and the button says whether it is expanded. Its name is the summary line and the badge: "Elevated error rates in US-East Investigating". It opens with Enter or Space, and its aria-controls points at the panel.
How do I start it open?
Give Collapsible the defaultOpen prop.
The poster shows it closed, which is how a banner should arrive; open it by default only on the incident's own page.
Related
- Pro
Expandable Banner
Disclosures and tabsA fee-change notice for a rent-collection tool as a card in card: one header line that opens a sentence, three rows of facts (Now, From next renewal, Why) and a link.
- Pro
Expandable Timeline Banner
Disclosures and tabsA parcel notice for a tracking product as a disclosure: a header that names the current stage and its step, and a vertical four-step timeline when opened.
- Pro
Maintenance Alert Banner
AlertsA maintenance callout for a managed database service: a warning heading and two sentences over a second band that draws the day as 24 hour cells, with the two hours inside the window filled.
- Pro
Services Status Live Banner
Live statusA services callout for a cloud platform: a green dot and a heading that counts "All 12 of 12 services operational" from the data, a status-page link, and a matrix of the twelve services on shared hairlines.
- Pro
Stacked Alert Banner
AlertsFour notices from an invoicing back office in one framed list: an error, a warning, an info and a success, each with its own close button, a live count and a Dismiss all.
- Pro
Top Bar Banner
Top barsA slim announcement strip for a writing app's release: one centred line with the version, the news and an underlined link, and a ghost button that folds the strip away.