Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Loading Secondary Button Spinner for Solid

A disabled secondary button with a spinner in front of Saving Changes. Nothing in the demo is saved.

UI library: Ark UI

A secondary button is disabled. A spinner sits before the words Saving Changes. The spinner is hidden from assistive tech. No save runs.

Use the secondary style for a side action such as saving a draft. The label should name the action that is running. A long save with a percent fits Progress. In Solid, Ark UI does not watch the save. You show the spinner.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Spinner anatomy: item, spinner, title

Usage

<Button disabled variant="secondary">
    <Spinner aria-hidden="true" data-icon="inline-start" />
    Saving Changes
  </Button>

FAQ

How is this a secondary button?

variant is secondary on the Button. The children are the Spinner and the text Saving Changes. disabled is set, so the button can't be pressed again.

How does the spinner line up with Saving Changes?

The Spinner is the first child, with data-icon set to inline-start. That uses the button's icon spacing, so the wheel sits in front of the words.

What color is the spinner here?

The icon uses currentColor, so it takes the secondary button's text color. This file sets no extra color class on the Spinner.

Why does the label say Saving Changes?

That string is the button's text in this file. It tells people which action is running. Swap it for another short status and leave the Spinner and variant as they are.

What does a screen reader announce?

The button's name is Saving Changes, with its disabled state. The Spinner has aria-hidden="true", so it adds nothing to that name.

How do I stop the spin for reduced motion?

Add motion-reduce:animate-none on the Spinner. The secondary button stays disabled with "Saving Changes", and the icon stops.

API Reference

Button

Sets disabled and variant="secondary". The rest is on the Button page.

Spinner

Sets aria-hidden and data-icon="inline-start". The rest is on the Spinner page.