CraftUI

Spinner

A pixel loading spinner, and an overlay that covers content while it loads.

LoadingLoadingLoadingGenerating world

Installation

npx shadcn@latest add @runqora/craft-spinner

Usage

import { LoadingOverlay, Spinner } from "@/components/craft/spinner";

<Spinner label="Loading worlds" />;

<LoadingOverlay loading={isLoading}>
  <WorldList />
</LoadingOverlay>;

Examples

Loading overlay

The content stays in place while it loads, so the layout doesn't jump, but it can't be clicked or focused.

Lifeboat

1,824 players online

Props

Spinner

Prop

Type

LoadingOverlay

Prop

Type

Accessibility

  • Both are a status, so screen readers announce the label. The spinner's label is hidden on screen unless you set showLabel.
  • The overlay marks its content aria-busy and inert while loading.
  • With reduced motion, the spinner stays still.
  • For progress you can measure, use Progress instead.

Customization

The spinner takes the text color, so set className="text-craft-primary" or any other color on it. The overlay's cover uses --craft-overlay.

Dependencies

  • shadcn's utils, and craft-theme

Source

On this page