Spinner
Migration guide for Spinner from HeroUI v2 to v3
Refer to the v3 Spinner documentation for complete API reference, styling guide, and advanced examples. This guide only focuses on migrating from HeroUI v2.
Overview
The Spinner component in HeroUI v3 has been simplified to a single circular spinner variant. The label, variant, and labelColor props have been removed.
Structure Changes
v2: Multiple Variants with Label
In v2, Spinner supported multiple variants and labels:
import { Spinner } from "@heroui/react";
<Spinner variant="default" label="Loading..." color="primary" />v3: Single Variant
In v3, Spinner is simplified to a single circular variant:
import { Spinner } from "@heroui/react";
<Spinner color="accent" />Key Changes
1. Component Behavior
v2: Supported multiple variants (default, simple, gradient, wave, dots, spinner) and labels
v3: Single circular spinner variant, no label support
2. Prop Changes
| v2 Prop | v3 Prop | Notes |
|---|---|---|
label | - | Removed (add label manually if needed) |
variant | - | Removed (only one variant) |
labelColor | - | Removed (no label support) |
classNames | - | Use className prop directly |
size | size | Changed: "sm" | "md" | "lg" → "sm" | "md" | "lg" | "xl" |
color | color | Changed: "default" | "primary" | "secondary" | "success" | "warning" | "danger" → "current" | "accent" | "success" | "warning" | "danger" |
3. Removed Props
The following props are no longer available in v3:
label- Add label manually with separate element if neededvariant- Only one spinner variant availablelabelColor- No label supportclassNames- UseclassNameprop directly
4. Changed Color Values
"default"→"current"(inherits current text color)"primary"→"accent""secondary"→ Removed (use"current"or"accent")"success","warning","danger"→ Still available
Migration Examples
Basic Usage
Basic usage remains unchanged in v3:
import { Spinner } from "@heroui/react";
export default function App() {
return <Spinner />;
}import { Spinner } from "@heroui/react";
export default function App() {
return <Spinner />;
}With Label
<Spinner label="Loading..." /><div className="flex flex-col items-center gap-2">
<Spinner />
<span>Loading...</span>
</div>Sizes
<div className="flex gap-4">
<Spinner size="sm" />
<Spinner size="md" />
<Spinner size="lg" />
</div><div className="flex gap-4">
<Spinner size="sm" />
<Spinner size="md" />
<Spinner size="lg" />
<Spinner size="xl" />
</div>Colors
<div className="flex gap-4">
<Spinner color="default" />
<Spinner color="primary" />
<Spinner color="secondary" />
<Spinner color="success" />
<Spinner color="warning" />
<Spinner color="danger" />
</div><div className="flex gap-4">
<Spinner color="current" />
<Spinner color="accent" />
<Spinner color="success" />
<Spinner color="warning" />
<Spinner color="danger" />
</div>Variants (Removed)
<div className="flex gap-4">
<Spinner variant="default" />
<Spinner variant="simple" />
<Spinner variant="gradient" />
<Spinner variant="wave" />
<Spinner variant="dots" />
<Spinner variant="spinner" />
</div>{/* Only one variant available - circular spinner */}
<Spinner />
{/* For other spinner styles, consider using CSS animations */}Custom Styling
<Spinner
classNames={{
base: "custom-base",
wrapper: "custom-wrapper",
circle1: "custom-circle1"
}}
/><Spinner className="custom-spinner" />With Label and Custom Styling
<Spinner
label="Loading..."
labelColor="primary"
classNames={{
label: "text-foreground mt-4"
}}
/><div className="flex flex-col items-center gap-2">
<Spinner />
<span className="text-foreground mt-4">Loading...</span>
</div>Color Mapping
When migrating colors, use this mapping:
| v2 Color | v3 Color | Notes |
|---|---|---|
"default" | "current" | Inherits current text color |
"primary" | "accent" | Use accent color |
"secondary" | "current" or "accent" | Use current or accent |
"success" | "success" | No change |
"warning" | "warning" | No change |
"danger" | "danger" | No change |
Breaking Changes Summary
- No Label Support:
labelprop removed - add label manually if needed - No Variants:
variantprop removed - only one circular spinner available - No Label Color:
labelColorprop removed - style label manually - Color Values Changed:
"default"→"current","primary"→"accent","secondary"removed - Size Added: New
"xl"size option available - ClassNames Removed: Use
classNameprop directly
Tips for Migration
- Remove label prop: If using
label, wrap Spinner and add label as separate element - Remove variant prop: Only one spinner variant available in v3
- Update colors: Map
"default"→"current","primary"→"accent", remove"secondary" - Update classNames: Replace
classNamesprop withclassNameprop - Add manual labels: If you need labels, add them as separate elements with appropriate styling
- Consider alternatives: For other spinner styles (wave, dots, etc.), consider CSS animations or other libraries
Need Help?
For v3 Spinner features and API:
- See the API Reference
- Check interactive examples
For community support: