About this set
Two submit-style buttons that show work in progress and then success. Save changes shows a spinning ring next to the label, which changes to Working while the task runs; afterwards the button turns green with a tick and the word Done, then returns to its idle label. Upload file does the same and also fills the button with a darker layer from left to right over two seconds, a simple progress effect for uploads and exports. The demo fakes the task with a timer, and the script marks the one line to replace with your real request. State lives in attributes rather than classes: the script sets aria-busy=”true” while working and data-state=”done” on success, and the CSS shows the spinner, tick and colours from those attributes, so the same script drives the plain CSS, Bootstrap and Tailwind versions. The button keeps focus the whole time and ignores repeat clicks while busy, and a visually hidden status line announces the progress to screen readers. Use it for saves, uploads, payments and any action that takes more than a moment. The Bootstrap version uses .spinner-border, resized through its –bs-spinner-* variables.
What’s included
- Spinner, success tick and idle states driven by aria-busy and data-state
- Progress fill variant for uploads and exports
- One script shared by all three versions
- Repeat clicks ignored while the task runs
- Polite live region announces working and done
Accessibility
While busy each button carries aria-busy="true" and its visible label changes, and a role="status" line announces, for example, Save changes: working and then Save changes: done. The button is never disabled, so keyboard focus stays on it, and focus shows a 2px blue outline. Under prefers-reduced-motion the progress fill is removed and the spinner slows to 1.5 seconds per turn.
Customise it
Change the idle colour on .lb (or --bs-btn-bg on .btn-load in Bootstrap, bg-[#2563eb] in Tailwind) and the success colour in the [data-state="done"] rule. The spinner size is set on .lb-spin, through --bs-spinner-width in Bootstrap, and by size-[17px] in Tailwind.

















