shadcn.io is not affiliated with official shadcn/ui
Centered Version Switcher Hero Block for React
A compact centred hero whose version tabs swap the headline, the subtitle and three what's-new cells for each major release of a rules engine.
Installation
Overview
A compact centred hero that lets visitors compare your product's major releases without leaving the page. A pill of version tabs, with a New badge on the current release, swaps a two-line headline with a muted second line, a subtitle and three "What's new" cells, each fading in as you switch, while the Shine Button and the outline button stay where they are. The cells are separate boxes between solid page rails, their hairlines running a little past their corners with a + mark on the top-start one, each with a plus icon and one change. It's built from Tabs, Badge, Status, Guides, Shine Button and Button, with CSS transitions for the motion and your theme's tokens for every colour, and the copy is for Switchyard, a fictional rules engine. For developer tools with frequent major releases, SDK landing pages, and product sites that want to show how the product has grown, right in the hero.
FAQ
How do I change the versions and their copy?
Edit VERSIONS at the top of the file. Each version has an id, the tab's label, the headline's two lines (headline, then the muted highlight), a subtitle and its changes, the three entries of the "What's new" cells. Add or remove versions and the tabs follow. isCurrent: true puts the New badge on that version's tab.
The tab that opens first is the Tabs' defaultValue, the current release's id.
Why doesn't the page move when I switch versions?
The headlines and lists aren't the same length, so each version would make the hero a different height and push the page below it up or down. Behind the visible version, every version's copy, buttons and cells sit invisibly in the same grid cells and are hidden from assistive tech: the longest one sets each row's height, at every screen width, and a shorter version is centred in the space. The tabs, the buttons and the cells stay in place.
Is the version switcher accessible?
Yes. It's a real tab list named "Product version": the arrow keys move between versions, and each tab controls its own panel. The panel holds the page's h1, and only the selected version's panel is in the page, so there's always one headline. The New badge is part of the third tab's name, the cells are a list named "What's new in v3", and the plus icons are hidden from screen readers. With reduced motion, the copy changes without fading.
Can a link open a specific version?
Yes: make the tabs controlled and set the version from your route, for example a ?version=v2 query.
Pass Tabs a value and an onValueChange, which receives the new value.
How does it fit on a phone?
The headline steps down from text-5xl to text-4xl and wraps where it must, the buttons wrap onto a second line when they don't fit side by side, and the three short tab labels stay on one line. The three cells stack, one under another, at the column's width, so the button is on the first screen.
When should I use a version switcher instead of a static headline?
Use a version switcher when your releases differ enough that contrasting them sells the latest one, such as a move from a CLI tool to a visual builder. Use a static headline when only the current release matters, or when your history is better told on a changelog page; the Changelog hero puts recent releases under a single headline.
Related
- Pro
Changelog Hero
Updates and timelinesA 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 timelinesA 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
Centered Audience Tabs Hero
Interactive demosA compact centred hero with a role switch in a band that swaps the headline, the subtitle and a band of three checklist cells for designers, engineers and product teams.
- Pro
A centered single-plan hero with a monthly and annual switch under the headline, then one band split by a hairline: the price beside a Shine Button, and six included features.
- Pro
Split Feature Flags Hero
Product windowsA split hero for a feature-flag service: the headline, a Shine Button and three ticks beside a narrow flags dashboard in a hairline frame, with environment tabs, rollout meters and a working switch on every flag.
- Pro
Centered Launch Badge Hero
Logos and social proofA 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.