Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Dismissible Announcement Bar Hero Block for React

A showcase hero for a release planning tool: a dismissible announcement band, a headline beside the pitch, a Shine Button, a trust line and a framed sketch of a release board that runs off the bottom.

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

Lead with a dismissible announcement bar on top of a showcase hero, for React with Base UI. The section sits on the page's drafting lines: two rails at the edges of the page column that continue into the blocks above and below, and a rule along its top edge with a plus mark on each crossing. The bar is a band across the column, with a hairline and plus marks along its bottom edge: a New badge, one sentence about Plumline 3.0 and a link to the announcement, and a close button that folds it away, easing its height and opacity to nothing with a CSS transition while focus moves on to the headline. Below it, a large headline sits on the start side beside the pitch on the other: a subtitle, a primary ShineButton and an outline Button as links, and a trust line. A framed sketch of the product closes the block: an app window on a release board, with a sidebar, three columns of task cards and a Deploy button, drawn in greys with the theme's tokens, sitting in a tinted panel whose hairlines run a little past its corners with a plus on each, and faded out at its bottom edge with a CSS mask. It's built from Guides, Badge, Button, Shine Button, Avatar and Skeleton with Lucide icons and Tailwind CSS. Made for product launches, conference announcements, SaaS landing pages and any page with news worth a line above the fold.

FAQ

How do I change what the announcement bar says?

Edit ANNOUNCEMENT at the top of the file: the badge's label, the sentence (text), the link's words (link) and where it goes (href). Keep it to one sentence and one link, so it fits on a single line from the sm breakpoint up; on a phone it wraps beside the badge. The link is underlined, so it doesn't rely on its weight alone to read as a link.

How do I keep the bar closed after a visitor dismisses it?

Remember the dismissal under a key for this announcement, such as dismissed-v3-launch, so the next announcement shows again. A cookie is the smoothest: the server reads it and renders the page with the bar already closed, so it never flashes. With localStorage, read the key in the browser after the first render and close the bar then; a returning visitor will see it fold away once.

How does the bar fold away, and what happens with reduced motion?

The bar sits in a one-row CSS grid. Dismissing it sets data-state="closed", which eases the row from 1fr to 0fr and the opacity to 0 over 300 ms, so the hero below slides up smoothly without measuring any height in script. The hairline and plus marks along its bottom edge belong to the bar's wrapper, outside the folding row, so when the bar is closed they sit on the top rule and disappear into it. The bar stays in the page but becomes inert: hidden from screen readers and out of the tab order. With reduced motion turned on it closes at once.

How are the lines and plus marks drawn?

They are the Guides component, an aria-hidden layer that draws the lines of the box it sits in. The page column (max-w-6xl, the same in every block) has Guides bleed marks="top" rules="top": two side rails that run the section's full height, so they join the rails of the blocks above and below, and one rule along the top edge that runs to the page's edges, with a plus on each crossing. The block below draws the next rule, so a stack of blocks never doubles a line. Inside, the bar's bottom edge is <Guides marks="bottom" rules="bottom" sides={false} />, and the board sits in Guides extend="sm" marks="corners", a frame of hairlines that run 0.5rem past its corners with a plus on each. Every line is solid and is the theme's border colour, so it follows any preset.

Is the bar accessible with a keyboard and a screen reader?

Yes. The close button is a real button named Dismiss announcement. When it's pressed, focus moves to the headline, the block's one h1, instead of being lost with the button, so a screen reader reads the headline next and Tab carries on from there. The link and both calls to action are links named by their text, and the trust line is a list whose separator is hidden.

How do I swap the sketched board for a product screenshot?

The board is WorkspacePreview, a small component at the top of the file. Replace the window inside its tinted panel with an img (or your framework's image component) with className="size-full object-cover object-top" and an alt that says what the screenshot shows, and keep the frame's Guides. Or keep the sketch and edit BOARD, SIDEBAR and TEAM so it shows your own product's words. The sketch is decoration: it's aria-hidden and inert, so screen readers skip it and nothing in it can be focused. On a phone the board scrolls under a fade at its end edge, and it's 18rem tall so the buttons stay on the first screen.

  • Pro

    Reverse Split News List Hero

    Updates and timelines

    A reverse split hero on drafting lines for a team docs workspace: a greyscale product illustration beside an announcement pill, the headline, a ruled list of the latest updates as links, a Shine Button and a second action.

  • Pro

    Changelog Hero

    Updates and timelines

    A compact centred hero for a build platform that ships weekly, over three release cells with hairlines that overshoot their corners.

  • Pro

    Changelog Preview Hero

    Updates and timelines

    A split hero for a code editor that releases on a schedule: the headline on one side, a ruled ledger of the four latest releases across a divider.

  • Pro

    A compact centred launch hero on solid rails with a live countdown as a full-width band of four cells and an email form whose Shine Button shows its loading and success states.

  • Pro

    Centered Launch Badge Hero

    Logos and social proof

    A centered launch-day hero with a rank badge that links to the launch page, a Shine Button and three launch metrics in separate cells whose hairlines overshoot their corners.

  • Pro

    Centered Award Badge Hero

    Logos and social proof

    A compact centered hero led by an award plaque in a hairline frame, with a headline, a Shine Button and an outline button, then one band of three more recognitions.