SwipeUI
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

ExportWhat it is
COLOR_TOKENSEvery colour token name, as a readonly array
colorVariable(token)The CSS variable for a colour token: colorVariable('primary') is '--color-primary'
RADIUSRadii in points: sm 6, md 10, lg 14, xl 20, full 9999
TYPE_SCALEEach text style's fontSize, lineHeight and fontWeight
MAX_FONT_SIZE_MULTIPLIERFont-scale caps, such as tabLabel: 1.4
MIN_TOUCH_TARGET44

Usage

components/home-icon.tsx
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

  • RADIUS and TYPE_SCALE are the defaults. If you change the tokens in global.css, change these to match, or read the values with useCSSVariable.

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 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