Components

Spinner

An indicator that can be used to show a loading state.

PreviewSource
Processing payment...
$100.00
Example requirements

Also uses: Item.

Installation

Complete the project setup first. The init command configures TypeScript, Vite, Tailwind CSS v4, and Preact compatibility.

CLI

Run init once using the installation guide, then add this component. The CLI copies the required source files and installs their exact dependencies with Bun.

bunx --bun github:LiasCode/shadcn-preact#main add spinner

Add --dry-run to review the changes. Existing modified files are protected; use --overwrite only when you want to replace them.

Manual installation / degit (optional)

1. Install dependencies

bun add --exact cn@0.4.0 lucide-preact@1.55.0 preact@11.0.1 tw-animate-css@1.4.0

2. Copy the component with degit

Run this from your project root. It selects spinner.tsx, its local dependencies, and both licenses directly from the repository, then copies them into src/components/ui.

bunx degit@3.10.0 https://github.com/LiasCode/shadcn-preact#main ./.cache/shadcn-preact/spinner --files LICENSE.md,registry/ui/lib/utils.ts,registry/ui/primitives/LICENSE,registry/ui/primitives/internals/types.ts,registry/ui/spinner.tsx --force
mkdir -p ./src/components/ui
cp -R ./.cache/shadcn-preact/spinner/registry/ui/. ./src/components/ui/
cp ./.cache/shadcn-preact/spinner/LICENSE.md ./src/components/ui/LICENSE.md

The temporary copy lives in .cache/shadcn-preact/spinner. Existing components stay in place; shared source files are updated from main.

Selected source files (4)

Usage

import { Spinner } from "./components/ui/spinner"
<Spinner />

Examples

Customization

You can replace the default spinner icon with any other icon by editing the Spinner component.

CustomizationSource
Example requirements
bun add --exact cn@0.4.0 lucide-preact@1.55.0

Size

Use the size- utility class to change the size of the spinner.

Button

Add a spinner to a button to indicate a loading state. Place the <Spinner /> before the label with data-icon="inline-start" for a start position, or after the label with data-icon="inline-end" for an end position.

ButtonSource
Example requirements

Also uses: Button.

Badge

Add a spinner to a badge to indicate a loading state. Place the <Spinner /> before the label with data-icon="inline-start" for a start position, or after the label with data-icon="inline-end" for an end position.

BadgeSource
SyncingUpdatingProcessing
Example requirements

Also uses: Badge.

Input Group

Input GroupSource
Validating...
Example requirements

Also uses: Input Group.

bun add --exact lucide-preact@1.55.0

Empty

EmptySource
Processing your request
Please wait while we process your request. Do not refresh the page.
Example requirements

Also uses: Button, Empty.

Reference

See the official Spinner documentation for composition patterns and API details. This page uses the Preact port and examples from the pinned upstream revision.

Component source