Use Spinner inside buttons, overlays, or empty states while content loads.
Setup
<script lang="ts">
import { Spinner } from '.';
</script> Default spinner
<Spinner />
<Spinner color="gray" />
<Spinner color="green" />
<Spinner color="red" />
<Spinner color="yellow" />
<Spinner color="pink" />
<Spinner color="purple" />
<Spinner color="blue" /> Sizes
size maps to Tailwind height/width: 4, 5, 6, 8, 10, 12, 16.
<Spinner size="4" />
<Spinner size="6" />
<Spinner size="8" />
<Spinner size="10" />
<Spinner size="12" /> Types
default
dots
bars
pulse
orbit
<Spinner type="default" />
<Spinner type="dots" color="blue" />
<Spinner type="bars" color="green" />
<Spinner type="pulse" color="purple" />
<Spinner type="orbit" color="indigo" /> Inside a button
Buttons support a built-in loading prop; you can also nest a Spinner manually.
<script lang="ts">
import { Button, Spinner } from '.';
</script>
<Button disabled>
<Spinner size="4" color="white" class="me-2" />
Saving…
</Button> Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'default' | 'dots' | 'bars' | 'pulse' | 'orbit' | 'default' | Animation style |
color | 'primary' | 'secondary' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'white' | 'primary' | Fill / accent color |
size | '4' | '5' | '6' | '8' | '10' | '12' | '16' | '8' | Tailwind size |
currentFill | string | — | Override SVG fill |
currentColor | string | — | Override SVG color |
class | ClassValue | — | Extra classes |
...rest | SVG attributes | — | Passed to the root SVG (color / type omitted) |