DocsHooks & utilities
tokens
SwipeUI's token names, radii, type scale and touch-target size as TypeScript values.
SwipeUI's colour token names, radii, type scale and touch-target size as TypeScript values, for styles that can't use class names.
Free (MIT)Version 1.2.0Released 2 Nov 2026iOS and Android
When to use it
- Read token names and default layout constants where classes cannot reach a native prop.
When not to use it
- Read CSS variables instead of default constants when a value must follow the current preset.
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 tokens- Adds
components/swipeui/lib/tokens.ts.
Class names cover most styling. These values are for the places they can't reach: Reanimated styles, native props such as an icon's colour, and layout maths.
Exports
| Export | What it is |
|---|---|
COLOR_TOKENS | Every colour token name, as a readonly array |
colorVariable(token) | The CSS variable for a colour token: colorVariable('primary') is '--color-primary' |
RADIUS | Radii in points: sm 6, md 10, lg 14, xl 20, full 9999 |
TYPE_SCALE | Each text style's fontSize, lineHeight and fontWeight |
MAX_FONT_SIZE_MULTIPLIER | Font-scale caps, such as tabLabel: 1.4 |
MIN_TOUCH_TARGET | 44 |
Usage
import { SymbolView } from 'expo-symbols';
import { useCSSVariable } from 'uniwind';
import { colorVariable, MIN_TOUCH_TARGET } from '@/components/swipeui/lib/tokens';
const tint = useCSSVariable(colorVariable('tab-active'));
<SymbolView name="house" tintColor={tint as string} size={MIN_TOUCH_TARGET / 2} />;Gotchas
RADIUSandTYPE_SCALEare the defaults. If you change the tokens inglobal.css, change these to match, or read the values withuseCSSVariable.
Accessibility
- MIN_TOUCH_TARGET is 44pt; visual control size alone is not a touch-target guarantee.
Motion
- Static on its own; any movement comes from the parent that animates it.
- No custom movement is configured by this item.
Performance
- Static constants; no subscriptions or views.
Notes for AI
- Use colorVariable with Uniwind useCSSVariable for the active theme.
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.