SwipeUI
DocsHooks & utilities

Text segments

Conservative whole-run shaping fallbacks for text motion.

Conservative shaping-safe motion segmentation with whole-run fallbacks.

Free (MIT)Version 1.0.0Released 27 Oct 2026iOS and Android

When to use it

  • Share conservative motion segmentation across text effects.

When not to use it

  • This is not a linguistic tokenizer or a general Unicode grapheme implementation.

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-segments
  • Adds components/swipeui/lib/text-segments.ts.

Usage

lib/headline.ts
import { segmentMotionText } from '@/components/swipeui/lib/text-segments';

segmentMotionText('Hello world', 'word'); // ['Hello', ' ', 'world']
segmentMotionText('مرحبا'); // one complete shaped run

Joined scripts, combining marks, emoji sequences and bidi controls retain a whole text run. This deliberate fallback protects readable glyphs; it is not a general linguistic tokenizer. Use the shared helper instead of splitting contextual glyphs to force an effect.

Accessibility

  • This helper adds no accessibility behavior; the rendered component owns its semantics.

Motion

  • Static on its own; any movement comes from the parent that animates it.
  • No custom movement is configured by this item.

Performance

  • Pure string helpers; no animation frames, timers or views.

Notes for AI

  • Joined scripts, combining marks, emoji sequences and RTL deliberately retain the complete text run.

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

On this page