Skip to content

Spinner

Animated loading spinner with multiple built-in animation styles. Extends Text props for styling.

Import

tsx
import { Spinner } from "silvery"

Usage

tsx
<Spinner />
<Spinner type="arc" label="Loading..." />
<Spinner type="bounce" interval={120} />

Props

All Text props are supported (color, bold, dim, etc.) in addition to:

PropTypeDefaultDescription
type"dots" | "line" | "arc" | "bounce""dots"Animation style
labelstringLabel text shown after spinner
intervalnumber80Animation interval in milliseconds

Animation Styles

TypeFramesDescription
dots⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏Braille dot spinner (default)
line| / — \Classic line spinner
arc◜ ◠ ◝ ◞ ◡ ◟Arc rotation
bounce⠁ ⠂ ⠄ ⡀ ⢀ ⠠ ⠐ ⠈Bouncing braille dot

Examples

With Label

tsx
<Spinner label="Fetching data..." color="$primary" />

Output: ⠋ Fetching data... (animated)

Styled Spinner

tsx
<Spinner type="arc" color="$success" bold />

Loading State

tsx
function DataView({ isLoading, data }) {
  if (isLoading) {
    return <Spinner label="Loading..." />
  }
  return <Text>{data}</Text>
}

Released under the MIT License.