Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Alert Banner Notification Block for React

An operations console's banner bar over a sketch of its app: four notices queue by urgency and show one at a time, with Previous, Next, a link, Dismiss and Snooze all for an hour.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Show one notice at a time, most urgent first, with this alert banner for React with Base UI. It's the top of Beacondesk, an operations status console, drawn in greys inside a hairline frame with a plus mark on each corner: a banner bar across the stage over a sketch of the app header and page. Four notices are queued (a failing webhook, a nearly full disk, a maintenance window and a finished backup), but only one is on screen, ranked error, warning, info and success. Each is a catalog Alert strip with a glyph, a level word in an outline Badge, a sentence, a link and a Dismiss. Under it, Previous and Next walk the queue ("Banner 1 of 4"), Snooze all for 1 hour holds the lot until a typed time and Restore brings back what was dismissed. The bar's room is held by the tallest banner, so the app under it never moves. It's built from Alert, Badge, Button and Guides, with CSS motion only. For consoles, dashboards and any app with more notices than room.

FAQ

How is the queue ordered?

Each banner has a level (error, warning, info or success) and queueOf sorts what is not dismissed by the ORDER list at the top of the file, so an error always comes first whatever order notices arrive in. Dismissing the one on screen moves the next one up into the same place; Previous and Next walk the queue round, so after the last comes the first. The pager says where you are in words ("Banner 2 of 4"), and the same words go to the status line.

How does it tell an error from an info notice without colour?

By a glyph, a word and a weight: a circle with an exclamation mark, a triangle, an info mark and a check; the word (Error, Warning, Info, Success) in a badge; and an error title that is semibold with a bar at the banner's start. The only status colour is the error's icon. The banner is a plain note, not an alert, so it doesn't interrupt anyone; the status line says what changed after each press.

What does Snooze all do?

It hides the whole queue and puts a one-line note in the bar's place, "Banners are snoozed until 10:30 UTC", with a Show now button; the pager reads Snoozed and Previous and Next say why they wait. The time is the page's fixed "now" plus an hour, typed in the file; in your app, store the wake time and compare it with the clock when the page opens. Nothing here is stored: a reload brings every banner back.

What is left when everything is dismissed?

The same bar, quiet: "No banners. Everything has been dismissed." and a Bring them back button, so the frame never changes height. Restore in the pager does the same job one dismissed banner at a time (it brings back all of them, and says how many).

How does it look on a phone?

The banner's sentence takes the full width and its link and Dismiss drop to a row under it; the pager's two groups wrap onto two lines. The bar still holds the height of the tallest banner, so nothing moves when you step through them, and the drawn app below shrinks to what is left.

  • Pro

    Four 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

    A banner stack in an on-call console window: a critical banner that cannot be dismissed, a warning and an info banner that fold away, and a Dismissed row that restores them, in a window that never changes height.

  • Pro

    A 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

    Connection Lost Notification

    Live and empty states

    A whiteboard that keeps working offline: an offline bar docked at the foot with Retry now and its attempt count, the list of edits waiting to send, troubleshooting tips, and Work offline to fold it to a pill.

  • Pro

    A what's new card for a product analytics app: three updates in a carousel with Previous, Next and the place in words, a Don't show this again box, and a Dismiss that folds the card.

  • Pro

    A news site's corner cookie card: Reject all and Accept all as equal buttons, a Customize that opens a switch for each optional kind with the cookies it sets, and a one-line receipt you can change.