SwipeUI

Slot text

Exact display strings roll through staggered reels while preserving shaped scripts and right-to-left text.

npx @swipeui/cli add slot-text
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Prices, balances or scores that should roll digit by digit when they change, like a slot machine.
  • Exact formatted values such as "$1,234.50" where every character must be correct.
  • Codes, times or labels that change one character at a time.
  • Text in any script, including right-to-left and joined scripts.

When not to use it

  • Numbers that should count through every value. Use Animated counter.
  • Words that change entirely. Use Text morph.
  • Static text. Use Text.

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 slot-text
  • Adds components/swipeui/ui/slot-text.tsx and 4 shared helpers.
  • Installs react-native-reanimated, clsx, tailwind-merge, react-native-worklets, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/wallet.tsx
import { SlotText } from '@/components/swipeui/ui/slot-text';

<SlotText text={balance} />;

Examples

price switches a personal plan between monthly and yearly billing. gate rolls a departure from Gate B12 to Gate C04. joined slides and fades the complete Arabic message in one stable container, preserving joined letters without outgoing reels or clipped shaping. Yearly, Change gate and Change message controls stay outside. The app and website use the same boards and content.

API reference

SlotTextProps

PropTypeDefaultDescription
textstring—

Complete display text; no numeric conversion occurs.

motion?MotionOverridethe app feel

Local number/morph character.

wrap?booleantrue

Allow reels to wrap; turn off for countdowns and prices inside controls.

className?string—

Root classes.

textClassName?stringfont-mono text-body

Text role classes.

style?StyleProp<ViewStyle>—

Native layout escape hatch.

testID?string—

Root identifier.

Native view/input props not listed here pass through where the exported TypeScript type allows them.

Composition and behavior

  • text is the exact string to show.
  • textClassName sets the style (monospace body by default).

Use wrap={false} for a countdown or price inside a control. Wrapping remains enabled by default.

SettingDefaultBehavior
wraptrueSet false to keep all reels on one line.

Behavior and gestures

  • Static; when text changes, each changed character rolls into place with a small stagger.
  • Unchanged characters stay put, so the eye goes to what moved.

Accessibility

  • The whole value is read once as a single label, never character by character.
  • Joined scripts like Arabic stay as one run, so letters keep their shapes.
  • Reduce Motion changes the text instantly.

Motion

  • Uses the number and layout motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Characters roll with the number role; width changes use the layout role.
  • Reduce Motion removes the roll.
  • Joined scripts use one stable, unclipped run that slides and fades on replacement; no outgoing reel remains in layout.

Performance

  • Only changed characters animate.

Notes for AI

  • Pass the exact display string; nothing is parsed or rounded.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items