Presets and theme files
Install a preset, choose a scheme and override semantic tokens in your own theme file.
Five presets are available: default, cinema, ride, tempo and cupertino. Each has complete light/dark palettes, semantic shape and font roles, a motion feel and a haptic default. Compare them in the theme gallery.
Install
npx @swipeui/cli init --theme cinema
# In an existing SwipeUI project:
npx @swipeui/cli theme add tempo cupertino
npx @swipeui/cli theme set tempoinit owns swipeui-theme.css, imported once from global.css. It migrates recognized old starter tokens, preserves unrelated CSS and keeps edited values unless --overwrite is explicit. theme set updates unchanged preset values and preserves your edits. Extra presets register named variants in a recognizable literal Metro configuration; dynamic configurations receive a manual step. Restart Metro with --clear after adding or removing a preset.
App choices
import { ThemeProvider, ThemeScope } from '@/components/swipeui/lib/theme';
<ThemeProvider preset="cinema" scheme="system">
<App />
<ThemeScope preset="tempo" scheme="dark">
<Preview />
</ThemeScope>
</ThemeProvider>;useTheme() exposes preset, scheme, resolvedScheme, setPreset and setScheme. Choices are in memory; persistence belongs to your app. Wrap providers above navigation. ThemeScope keeps choices and variables local without changing the global theme. Installed named themes are required; misspelled names fail visibly.
Override
Edit semantic variables in the owned file, including --radius-control, --radius-demo-action, --radius-field, --radius-card, --radius-sheet, --font-sans, --font-display, --font-mono, control heights and shadows. Keep both schemes complete. Runtime overrides are also available:
<ThemeProvider overrides={{ all: { '--radius-card': 18 }, dark: { '--color-primary': '#a5b4fc' } }}>
<App />
</ThemeProvider>Runtime variables must already exist in the CSS. Previous values are restored when overrides change or unmount. Platform font aliases keep system fonts portable; custom font registration remains your responsibility.
Set --swipeui-material: glass; for the active scheme to opt eligible components into the Glass theme when the Pro material provider is installed. Choose solid in a subtree when a surface needs an opaque fill.
Existing design systems
Existing token names and HeroUI shared values are preserved. Semantic names can mean different things between libraries, especially muted, accent, success and warning. Inspect both libraries in your own screens rather than assuming identical appearances. Run npx @swipeui/cli doctor after migration.
Provider API
| Prop | Type | Default | Description |
|---|---|---|---|
children | | — | |
preset? | | | Initial preset; subsequent choices belong to the app. |
scheme? | | | Initial scheme. |
basePreset? | | | Base preset name for a hand-authored CSS file without CLI metadata. |
motion? | | | App motion character. |
haptics? | | | Default haptic style; off disables all feedback. |
overrides? | | | Runtime values over the theme file; existing values are restored on cleanup. |
material? | | | Override the file's material for this subtree. |
renderSurface? | | — | Optional decorative renderer for component-owned surface slots. |
| Prop | Type | Default | Description |
|---|---|---|---|
children | | — | |
preset? | | | Installed preset for this subtree. |
scheme? | | | Local scheme; system follows the device. |
motion? | | | Optional local motion character. |
Accessibility
- System colour scheme is followed; motion retains system Reduce Motion and haptics have a global off switch.
Motion
- Static on its own; any movement comes from the parent that animates it.
- Switching the theme is immediate; premium animated theme transitions belong to a later phase.
Performance
- Theme updates occur on choice changes, not per animation frame.
Notes for AI
- Use ThemeScope for subtree theming and one ThemeProvider for global choices. The CLI records the base preset in CSS; hand-authored files can pass basePreset.
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.