shadcn.io is not affiliated with official shadcn/ui
Stacked Download Card Banner Block for React
A centred download card for a desktop sketching app: a version badge, a heading and a sentence over a tinted band with a three-platform segment control and a download button that runs idle, downloading and done.
Installation
Overview
A download card for React with Base UI, for a desktop app that ships a build for each system. A framed card with + marks on its corners holds a short heading with a version badge beside it and one sentence; under a solid rule, a tinted band holds a segment control of macOS, Windows and Linux next to the download button, and a line that says what that build needs. Once the page has loaded, the card chooses the visitor's own platform, so the button reads "Download for Windows" on a Windows machine; choosing another segment rewrites the button and the line under it. The button is the catalog's Download Button: it shows a download icon at rest, a spinner and a filling bar while it works, and a check when it's done. It's built from Guides, Download Button, Segment Group and Badge, with your theme's tokens for every colour. For desktop apps, command-line installers and any download where the right file depends on the machine.
FAQ
How does the card know which platform I'm on?
After the first render, an effect reads navigator.userAgent once and picks Windows, Linux or macOS (anything it can't place, a phone included, gets the macOS build). The server can't know, so until then the card says "desktop" and no segment is chosen; both are replaced on load without moving the page, because the button has a minimum width and the line under it shares one cell with every other line. The button's icon and label do shift a few pixels sideways when the label's length changes, since the label is centred. A visitor's own choice is never overwritten: the effect runs once.
How do I add a platform or change a size?
Edit BUILDS at the top of the file: each entry is the label on the segment and in the button, the line that names the installer's size and what the machine needs, and a platform key. Add a key to Platform and a branch to detect for a new system. The line's cell is as tall as the longest line, so a long one never makes the card jump.
Does the button really download something?
Not in the preview: it simulates a transfer so you can see all three states, five steps of 20 percent every 300 ms, then a check that stays for three seconds. To ship it, start your download in start (set href to the installer in a fetch or window.location) and feed the real progress into progress; while it's downloading the button ignores presses and keeps full strength, and a polite status inside it says the progress every quarter.
Why is the version a badge and not part of the heading?
The heading says what the app does, which stays true across releases; the version is data. Keep v2.4.1 in the badge and update it in one place when you ship. The installer's size lives in the line under the button, because it changes with the platform.
Related
- Pro
QR Download Split Banner
Split calloutsA scan-to-install callout for a mobile app: a real QR code in a card in card with a caption, beside the heading, one sentence and links to both store listings.
- Pro
An install pill for a plant-care app: a greyscale app tile, the name, a row of stars with its score, a small Get link and a dismiss button that folds the block away.
- 72%Pro
An export job in one row for an invoicing tool: a thin progress bar with its percentage and seconds left that fills once and turns into a Download button, with Cancel and Run again.
- $10$10Pro
Stacked Referral Invite Banner
Stacked cardsA referral card for a savings app: a heading, two reward cells (You get, A friend gets) joined by an arrow, and the invite link in a field with a Copy link button.
- Pro
Centered Stacked Banner
Stacked cardsA centred bonus offer for a music-learning app: a gift tile, a Limited time badge, a heading, a strip of fifteen month cells with the last three outlined as free, and a Shine Button.
- $Pro
Expandable Code Banner
Disclosures and tabsAn install notice for a CLI toolkit as a disclosure: a header with a version badge opens package-manager tabs and the command in a mono box with a Copy button.