Spinner
Continuous fading comet with constant rotation and configurable speed.
npx @swipeui/cli add spinnerWhen to use it
- Short waits with no known progress, such as loading a screen or refreshing.
- Inline loading next to a label, like "Saving…".
- Full-screen loading with the large size.
When not to use it
- Known progress. Use Progress.
- Content placeholders. Use Skeleton.
- Button loading; Button has its own.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add spinner- Adds
components/swipeui/ui/spinner.tsxand 4 shared helpers. - Installs uniwind, react-native-svg, react-native-reanimated, react-native-worklets, clsx, tailwind-merge, class-variance-authority. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { Spinner } from '@/components/swipeui/ui/spinner';
<Spinner label="Loading results" />;Examples
Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.
API reference
SpinnerProps
| Prop | Type | Default | Description |
|---|---|---|---|
variant? | | | Continuous fading comet, or explicit platform activity. |
speed? | | | Rotation speed multiplier. |
diameter? | | | Comet diameter override in points. |
color? | | | Theme colour override. |
label? | | | Named operation. |
size? | | | Comet size; native maps medium to its small activity indicator. |
active? | | | Show the activity state. |
motion? | | — | Reduce Motion displays a static status instead of continuous rotation. |
className? | | — | Root classes. |
style? | | — | Native layout escape hatch. |
testID? | | — | Root ID. |
Native view/input props not listed here pass through where the exported TypeScript type allows them.
Composition and behavior
- label names the work; size is small, medium or large; active shows or hides it.
Feedback lineup settings
| Prop | Does / default |
|---|---|
variant | Continuous comet or explicit platform activity. @default 'comet' |
diameter | Comet diameter override in points. @default 20, 24 or 36 from size |
color | Theme colour override. @default primary token |
label | Named operation. @default 'Loading' |
size | Comet size; native maps medium to small. @default 'small' |
active | Show the activity state. @default true |
motion | Reduce Motion displays a static status instead of continuous rotation. |
className | Root classes. |
style | Native layout escape hatch. |
testID | Root ID. |
The default is the trackless comet (variant="comet"), rendered as one slightly thicker continuous stroke with a tail fading to zero at every size. Rotation is linear through each revolution. speed accepts 0.5, 1 (default) or 2; switching speeds preserves full revolutions. variant="native" remains available for existing callers. The Sizes board combines all three sizes; Colors compares three semantic colours. Both expose speeds. variant="arc" remains a compatibility alias for comet. Hidden/background animation pauses; Reduce Motion shows the named static status.
Behavior and gestures
- Static; it spins while active and disappears when active is false.
Accessibility
- Announced as a busy progress indicator with its label, such as "Loading messages".
- Under Reduce Motion it shows the label with an ellipsis instead of spinning.
- Colour comes from your theme tokens.
Motion
- Uses the
ambientmotion role, so it follows your app's feel. Passmotionto tune this one instance. - One continuous SVG comet rotates at constant angular velocity; speed scales its token duration.
- Reduce Motion replaces it with static text.
Performance
- UI-thread rotation; pauses offscreen, in background and under reduced motion.
Notes for AI
- Give a specific label, such as "Loading orders".
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.