Search documentation

Search pages, components, blocks, styles and colours.

Get started
Skip to content

Spinner

PreviousNext

Twenty-two loading animations, from dot matrices to bouncing dots and turning tiles.

Spinner on iOS

Installation

bunx --bun fabricator-ui@latest add spinner

Usage

import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"
import { Text } from "@/components/ui/text"
{(
  [
    "orbit",
    "ripple",
    "cascade",
    "wave",
    "pulse",
    "braid",
    "comet",
    "bounce",
    "equalizer",
    "flip",
    "scan",
    "quad-swap",
    "quad-fold",
    "tic-tac",
    "bloom",
    "checker",
    "diagonal",
    "triangle",
    "square",
    "rings",
    "hex",
    "ring",
  ] as const
).map((value) => (
  <View key={value} className="items-center gap-3">
    <Spinner variant={value} className="size-8" />
    <Text>
      {value.charAt(0).toUpperCase() +
        value.slice(1).replaceAll("-", " ")}
    </Text>
  </View>
))}

Composition

  • Spinner
  • SpinnerProps
  • SpinnerVariant

Examples

spinner-example.tsx
import { View } from "react-native"
 
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"
import { Text } from "@/components/ui/text"
 
function SpinnerExample() {
  return (
    <ExampleWrapper>
      <Example
        title="Matrix patterns"
        className="flex-row flex-wrap items-center"
      >
        {(
          [
            "orbit",
            "ripple",
            "cascade",
            "wave",
            "pulse",
            "braid",
            "comet",
            "bounce",
            "equalizer",
            "flip",
            "scan",
            "quad-swap",
            "quad-fold",
            "tic-tac",
            "bloom",
            "checker",
            "diagonal",
            "triangle",
            "square",
            "rings",
            "hex",
            "ring",
          ] as const
        ).map((value) => (
          <View key={value} className="items-center gap-3">
            <Spinner variant={value} className="size-8" />
            <Text>
              {value.charAt(0).toUpperCase() +
                value.slice(1).replaceAll("-", " ")}
            </Text>
          </View>
        ))}
      </Example>
      <Example title="Sizes" className="flex-row items-center">
        <Spinner className="size-3" />
        <Spinner />
        <Spinner className="size-6" />
        <Spinner className="size-8" />
      </Example>
      <Example title="Colours" className="flex-row items-center">
        <Spinner className="text-primary" />
        <Spinner className="text-destructive" />
        <Spinner className="text-muted-foreground" />
      </Example>
      <Example title="In a button" className="flex-row flex-wrap items-center">
        <Button disabled>
          <Spinner />
          Saving
        </Button>
        <Button variant="outline" disabled>
          <Spinner />
          Loading
        </Button>
      </Example>
      <Example title="In a badge">
        <Badge variant="secondary">
          <Spinner className="size-3" />
          Syncing
        </Badge>
      </Example>
      <Example title="Labelled">
        <Spinner aria-label="Sending your message" />
      </Example>
    </ExampleWrapper>
  )
}
 
export { SpinnerExample }

Differences from web

Same. Twenty-two original Fabricator animations: 2×2, 3×3 and 4×4 grids, triangles, circles, squares, hexagons, bouncing dots and a classic ring, inspired by Dot Matrix by Shawn. Pick the project default with --spinner <variant> in the CLI. variant overrides it per instance, speed scales the cycle, and animated={false} pauses it. Native shares the geometry with web and animates on the UI thread; Reduce Motion and motion off leave a still indicator.

Accessibility

Parts set role="status", read by VoiceOver and TalkBack. Give a control with no text an accessibilityLabel.