Spinner
spinneruiLightweight loading indicator — circular spinner with three sizes and tone variants. Use inside buttons (replacing the icon when an action is in flight) or as a centered page loader.
Installation
$pnpm dlx shadcn-svelte@latest add https://uipkge.dev/r/svelte/spinner.json$npx shadcn-svelte@latest add https://uipkge.dev/r/svelte/spinner.json$yarn dlx shadcn-svelte@latest add https://uipkge.dev/r/svelte/spinner.json$bunx shadcn-svelte@latest add https://uipkge.dev/r/svelte/spinner.jsonManifest:
https://uipkge.dev/r/svelte/spinner.jsonInstalls to:src/lib/components/ui/spinner/Examples
Loading interactive previews…
Loading interactive previews…
Props
| Name | Type / Values | Default | Required |
|---|---|---|---|
size | 'default''sm''lg''icon' | default | optional |
npm dependencies
Used by
Files installed (3)
src/lib/components/ui/spinner/Spinner.svelte0.8 kB
<script lang="ts" module> import type { LucideProps } from '@lucide/svelte' import type { SpinnerVariants } from './spinner.variants' // LucideProps (extends SVGAttributes) so rest-spread into the icon // typechecks; `size` is the cva tier, not lucide's pixel size. export interface SpinnerProps extends Omit<LucideProps, 'size'> { size?: SpinnerVariants['size'] } </script> <script lang="ts"> import { Loader2 } from '@lucide/svelte' import { cn } from '$lib/utils' import { spinnerVariants } from './spinner.variants' let { class: className, size = 'default', ...restProps }: SpinnerProps = $props() </script> <Loader2 data-uipkge="" data-slot="spinner" class={cn(spinnerVariants({ size }), className as string | undefined)} aria-label="Loading" role="status" {...restProps} />src/lib/components/ui/spinner/spinner.variants.ts0.8 kB
import type { VariantProps } from 'class-variance-authority' import { cva } from 'class-variance-authority' /** * Variant definitions live in their own file (rather than the package * `index.ts`) so consuming Vue SFCs can import without creating a circular * dependency through the index. See card.variants.ts for the canonical * example + the SSR symptom that motivated the split. */ // motion-safe: honor prefers-reduced-motion (static glyph when reduced). export const spinnerVariants = cva('motion-safe:animate-spin text-muted-foreground', { variants: { size: { default: 'size-6', sm: 'size-4', lg: 'size-8', icon: 'size-4', }, }, defaultVariants: { size: 'default', }, }) export type SpinnerVariants = VariantProps<typeof spinnerVariants>src/lib/components/ui/spinner/index.ts0.1 kB
export { default as Spinner, type SpinnerProps } from './Spinner.svelte' export { spinnerVariants, type SpinnerVariants } from './spinner.variants'
Raw manifest:https://uipkge.dev/r/svelte/spinner.json