Spinner
scificn/spinnerFreeComponent
ASCII-style rotating spinner with optional label.
Live preview
live · rendered by the registry
Rendered by scificn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.scificn.dev/r/spinner.jsonSource
1'use client'23import * as React from 'react'4import { cn } from '@/lib/utils'56const frames = ['|', '/', '-', '\\'] as const7const sizeMap = { SM: '0.75rem', MD: '0.875rem', LG: '1rem' }89export interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {10 size?: 'SM' | 'MD' | 'LG'11 label?: string12}1314function Spinner({ className, size = 'MD', label, style, ...props }: SpinnerProps) {15 const [frame, setFrame] = React.useState(0)1617 React.useEffect(() => {18 const id = setInterval(() => setFrame((f) => (f + 1) % frames.length), 120)19 return () => clearInterval(id)20 }, [])2122 return (23 <span24 className={cn('inline-flex items-center gap-1.5 font-mono', className)}25 style={{ fontSize: sizeMap[size], color: 'var(--color-green)', ...style }}26 aria-label={label ?? 'Loading'}27 role="status"28 {...props}29 >30 <span31 style={{32 display: 'inline-block',33 width: '1ch',34 textAlign: 'center',35 textShadow: 'var(--text-glow-green)',36 userSelect: 'none',37 }}38 aria-hidden="true"39 >40 {frames[frame]}41 </span>42 {label && (43 <span44 style={{45 letterSpacing: '0.08em',46 color: 'var(--text-muted)',47 animation: 'blink-cursor 1.5s step-end infinite',48 }}49 >50 {label}51 </span>52 )}53 </span>54 )55}5657export { Spinner }
More from scificn
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | scificn | Components | Free | 1 dep | |
| Badgebadge | scificn | Components | Free | 1 dep | |
| Bar Chartbar-chart | scificn | Components | Free | no deps | |
| Breadcrumbbreadcrumb | scificn | Components | Free | no deps | |
| Buttonbutton | scificn | Components | Free | 2 deps | |
| Cardcard | scificn | Components | Free | no deps | |
| Checkboxcheckbox | scificn | Components | Free | 1 dep | |
| Dialogdialog | scificn | Components | Free | 1 dep |
