shadcn.io is not affiliated with official shadcn/ui
Upload Progress Chip Navbar Block for React
A file storage navbar whose Upload button becomes a progress chip with Cancel, settles on Uploaded, and updates a storage meter.
Installation
Overview
A file storage navbar for React with Base UI, the bar of Coffercloud. After the wordmark come My files, Shared, Starred and Trash, then a thin storage meter ("8.4 of 15.0 GB", from lg), then Upload, the one Shine Button. Pressing Upload turns it into a chip, "Uploading 2 files, 64%" with a Cancel button and a hairline that fills along its foot. The upload is simulated in the page: nothing is sent, and the percentage moves in ten steps over about four and a half seconds. The chip settles on "Uploaded 2 files" with a Done button, and the meter then counts the 500 MB. Cancel goes back to Upload and adds nothing. All three states share one grid cell, so the bar never changes size. On a phone the links and the meter move into a sheet from the top and the chip keeps only the percentage. The page's rails and top rule come from the Guides spine, and the bar stays 56 pixels high. It's built from Shine Button, Button, Progress, Sheet and Guides. For storage, backup and media tools that show work in progress where the action was.
FAQ
Does it upload anything?
No. The two files (320 and 180 MB), the steps and the timer are constants at the top of the file. Replace start with your upload call and feed the real percentage into step. The meter reads the used figure, which goes up by the size of the files once the chip settles. The meter stops at its limit.
What does a screen reader hear?
A polite status line speaks twice: "Uploading 2 files, 500 MB." when the upload starts, and "Uploaded 2 files. 8.9 of 15.0 GB used." when it ends, or "Upload cancelled. Nothing was added." The percentage in the chip changes silently, so it never chatters. The meter's bar is hidden from assistive technology because the words beside it carry the numbers.
Where does focus go when the button changes?
The pressed button leaves the tab order as its state ends, so focus is moved to the button that replaces it: Cancel while uploading, Done when it settles, and Upload again after Done or Cancel. The unseen states are inert, so a keyboard never lands on them.
Why doesn't the bar change size?
Upload, the chip and the settled chip sit in one grid cell, the inactive ones invisible and inert, so the cell is as wide as the widest. The words of the chip hide below sm, where it shows only the percentage or a check and Done, and the full text stays for screen readers.
How does it fit on a phone?
Below md the links leave the bar, and a menu button opens a sheet from the top with the links and the storage meter. The upload cell stays in the bar at every width. At 320 pixels the bar is the wordmark's icon, the menu button and the cell.
Escape closes the sheet and returns focus to the menu button.
What moves, and what happens with reduced motion?
The chip's fill grows with a short transition and the states cross-fade in 200 ms; with reduced motion both are instant. The steps still advance, because they are the upload itself, and Cancel is always there. A band of light sweeps across Upload once on hover and keyboard focus, and with reduced motion that light fades in where it stands.
Related
- Pro
Profile Checklist Progress Navbar
Meters and progressA one-bar navbar for a freelancer marketplace that tracks profile completion: a hairline fill along the bar's top edge, a percentage label, and a Complete profile button that opens a checklist whose boxes raise the percentage.
- Pro
Day Pips Trial Countdown Navbar
Meters and progressA one-bar navbar for an invoicing app in its free trial: four app links, a meter of fourteen day pips with the days to go that opens a popover of what ends, and an Upgrade Shine Button; the urgent state comes at three days.
- Pro
Create Menu Navbar
App toolbarsAn app bar with a Shine Create button that opens a grouped menu with working key hints and a New from template submenu, and a bottom drawer with the same rows on phones.
- Pro
Account Menu Navbar
Accounts and scopesAn app bar with an account button behind a split divider that opens a menu: an identity header with plan badge and storage bar, a Switch account radio list, and Profile, Settings, Billing and Sign out.
- Pro
An admin navbar for a marketplace console: a sidebar toggle, a search field scoped to Users, Orders or Logs, and a badge that counts pending approvals.
- Pro
Next Appointment Navbar
Players and clocksA booking navbar for salon software: links to the schedule, a next-appointment chip with a live countdown, and a New booking action.