Text shimmer
Token-colour text sweep with viewport/background/reduced-motion pause.
npx @swipeui/cli add text-shimmerWhen to use it
- Status text while something works, such as "Thinking…" in an AI chat or "Generating preview".
- Loading labels where a spinner feels too heavy.
- Drawing gentle attention to a waiting state.
When not to use it
- Text people need to read carefully.
- Long-running loads with known progress. Use Progress.
- Permanent labels.
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 text-shimmer- Adds
components/swipeui/ui/text-shimmer.tsxand 3 shared helpers. - Installs react-native-reanimated, uniwind, react-native-worklets. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { TextShimmer } from '@/components/swipeui/ui/text-shimmer';
<TextShimmer text="Preparing your workspace" />;Examples
status uses a semibold Thinking label close to its drawn assistant mark. colors uses bold title text and a wider primary-to-info colour sweep. The app and website share content, named boards and compact outside controls. The colors board also offers finite Cycles so you can inspect its resting colour.
Settings
| Setting | Default | Behavior |
|---|---|---|
text | required | Complete visible and spoken status. |
active | true | Explicit pause; offscreen and background pauses are automatic. |
speed | 1 | Positive finite playback rate. |
direction | 'forward' | 'reverse' sweeps from the end to the start. |
cycles | -1 | Positive whole sweep count, or -1 to loop. A completed sweep leaves every glyph on baseColor. |
baseColor | muted foreground token | Resting colour. |
highlightColor | foreground token | Sweep colour. |
spread | 2 | Positive finite half-width in glyphs. |
motion | app feel | Shared ambient feel; Reduce Motion holds plain text. |
className | absent | Root classes. |
textClassName | 'text-body' | Text style classes. |
style | absent | Native layout escape hatch. |
testID | absent | Root ID. |
Accessibility
The complete text is one accessible label; animated copies are hidden. Shaped scripts stay whole. Reduce Motion preserves the meaning. Native screen-reader, Dynamic Type and performance checks remain pending at 7.9.
Behavior and gestures
- Add speed, reverse direction, finite cycles, independent ink colours and spread; validate playback inputs. Real assistant and workspace boards replace active/paused.
- The application owns its content; demo controls sit outside the item.
Accessibility
- The status is read once as one label.
- Reduce Motion stops the sweep and shows plain text.
- Colour comes from your tokens, so contrast holds.
Motion
- Uses the
ambientmotion role, so it follows your app's feel. Passmotionto tune this one instance. - Add speed, reverse direction, finite cycles, independent ink colours and spread; validate playback inputs. Real assistant and workspace boards replace active/paused.
- Native runtime evidence remains pending at 7.9.
Performance
- Pauses automatically when not visible.
Notes for AI
- Set active={false} when the work finishes or the screen loses focus.
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.