UIPackage
Menu

Framework

Change language

Boilerplate repo

Spinner

spinnerui

Lightweight 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.

Also available for Vue ->

Installation

$npx shadcn@latest add https://uipkge.dev/r/react/spinner.json
Named registry:npx shadcn@latest add @uipkge-react/spinnerInstalls to:components/ui/spinner/

Examples

Loading interactive previews…

Props

NameType / ValuesDefaultRequired
size
'default''sm''lg''icon'
defaultoptional

Used by

Files installed (3)

  • components/ui/spinner/Spinner.tsx0.7 kB
    import * as React from 'react'
    import { Loader2 } from 'lucide-react'
    import { cn } from '@/lib/utils'
    import { spinnerVariants, type SpinnerVariants } from './spinner.variants'
    
    // Omit Lucide's own `size` (number|string) so the cva variant `size` wins.
    export interface SpinnerProps
      extends Omit<React.ComponentPropsWithoutRef<typeof Loader2>, 'ref' | 'size'>, SpinnerVariants {}
    
    const Spinner = React.forwardRef<SVGSVGElement, SpinnerProps>(({ className, size = 'default', ...props }, ref) => (
      <Loader2
        ref={ref}
        data-uipkge=""
        data-slot="spinner"
        className={cn(spinnerVariants({ size }), className)}
        aria-label="Loading"
        role="status"
        {...props}
      />
    ))
    Spinner.displayName = 'Spinner'
    
    export { Spinner }
    
  • components/ui/spinner/spinner.variants.ts0.8 kB
  • components/ui/spinner/index.ts0.1 kB

Raw manifest:https://uipkge.dev/r/react/spinner.json