Spinner
Tells people something is happening when you can't say how long it will take. Loading indicator adds a title and a short description.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add spinnerAlso works with shadcn:
npx shadcn@latest add @ritla/spinnerOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { LoadingIndicator, Spinner } from "@/components/ui/spinner";<LoadingIndicator title="Checking your balance" description="This usually takes a few seconds." /><Spinner size={24} color="brand" label="Loading" />Examples
Colors, sizes and dots
color brand, dark or light for the surface, and current follows the text color (in buttons). LoadingDots are three bouncing dots. Add a label to announce it.
API reference
LoadingIndicator
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | “Loading…” | Figma's Title: what is loading. |
description | ReactNode | None | Figma's Description. |
spinner | ReactNode | None | Figma's Spinner slot: any spinner or LoadingDots. |
Spinner
| Prop | Type | Default | Description |
|---|---|---|---|
size | 16 | 20 | 24 | 32 | 40 | 48 | None | Or size it with className. |
color | "current" | "brand" | "dark" | "light" | "current" | Figma's Color, and current for the text color. |
label | ReactNode | None | Makes it a role="status" announcing the text; without it, decorative. |
LoadingDots
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | None | As on Spinner. |
Accessibility
ARIA
- Loading indicator is
role="status", so its title and description are announced. - The animation stops when reduced motion is on.
- Don't show it for waits under a second, or more than one per screen.
Arabic and RTL notes
Mirrors
- The dots bounce in reading order.
Does not mirror
- The spinner turns clockwise in both directions.
- Numerals
- No numbers.
- Arabic typography
- The title is
label-14Medium, the descriptionlabel-12; centered.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)