SwipeUI

Settings detail

Any settings sub-page from the schema, with master switches, live appearance controls and choice lists.

npx @swipeui/cli add settings-detail
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

  • Notification, privacy, appearance or any other settings sub-page.
  • The list of choices behind a select row, such as Language.

When not to use it

  • Editing a profile. Use Settings Account.

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 settings-detail
  • Adds components/swipeui/settings/settings-detail.tsx, components/swipeui/settings/use-settings-detail.ts and 36 shared helpers.
  • Installs react-native-safe-area-context, react-native-svg, uniwind, clsx, tailwind-merge, react-native-reanimated, react-native-worklets, expo-haptics, class-variance-authority, react-native-gesture-handler, @expo/ui, @gorhom/bottom-sheet, expo-blur. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/settings/[page].tsx
import { router, useLocalSearchParams } from 'expo-router';
import { SettingsDetail } from '@/components/swipeui/settings/settings-detail';

export default function SettingsPage() {
  const { page } = useLocalSearchParams<{ page: string }>();
  const open = (next: string) => router.push({ pathname: '/settings/[page]', params: { page: next } });
  return <SettingsDetail page={page} backLabel="Settings" onBack={router.back} onOpenPage={open} onOpenSelect={open} />;
}

page is either a pages id or a select row's id. Inside SettingsProvider, every screen shares the same values, so a change here shows on the main screen when you go back.

Ready-made rows

settings-core includes row helpers for the common custom rows:

import {
  settingsTextSizeRow,
  settingsThemeRow,
  settingsTimeRangeRow,
} from '@/components/swipeui/settings/settings-parts';

const appearance = {
  title: 'Appearance',
  sections: [
    { id: 'theme', title: 'Theme', rows: [settingsThemeRow()] },
    { id: 'text', title: 'Text', rows: [settingsTextSizeRow()] },
  ],
};
const quietHours = settingsTimeRangeRow({ id: 'quiet-range', title: 'Schedule', dependsOn: 'quiet-hours' });
  • settingsThemeRow is a Theme Switch that changes the whole app as you pick.
  • settingsTextSizeRow is a slider over five text sizes, with a live sample; its value is the step.
  • settingsTimeRangeRow stores a From and To pair as one HH:mm/HH:mm value.

API reference

PropTypeDefaultDescription
pagestring—

A pages id, or a select row's id to show its choices.

data?SettingsDatathe provider's data, then the sample

The schema.

values?Readonly<Record<string, SettingsValue>>the provider's values, then each row's default

Controlled values by row id.

onChange?function—

Reports each change with the full set of values.

adapter?SettingsAdapterthe provider's adapter, then the mock

Runs destructive rows.

onOpenPage?((page: string) => void)—

A navigate row on this page was pressed.

onOpenSelect?((id: string) => void)—

A list select row on this page was pressed.

onBack?(() => void)—

Go back. Shows a back button in the drawn header.

backLabel?string'Back'

The back button's label, usually the previous screen's title.

closeOnSelect?booleanfalse

Go back after picking a choice on a select page.

onActionComplete?((id: string) => void)—

A destructive row's action finished.

onActionError?((error: unknown, id: string) => void)—

A destructive row's action failed.

header?"default" | "none"'default'

default draws the header; none sits under a native header.

largeTitle?booleanfalse

Start with a large title that collapses.

headerTrailing?ReactNode—

Content after the title in the drawn header.

confirmDestructive?booleantrue

Ask in a dialog before destructive rows that define confirm. Needs OverlayProvider.

haptics?booleantrue

Haptics for switches, choices and actions.

motion?MotionOverridethe app feel

Local motion feel or spring override.

messages?Partial<SettingsMessages>English

Built-in words.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Root style.

testID?string—

Root identifier. Parts append -back, -row-<id>, -option-<value> and -section-<id>.

Composition and behavior

  • A row with dependsOn dims and locks while that toggle, or anything it depends on, is off.
  • On a choice page the check moves to the new choice. closeOnSelect goes back as well; staying is the default, as in the system settings.
  • The compact header has a back button labelled with backLabel; header="none" sits under a native header.

Behavior and gestures

  • A master switch dims and locks every row that depends on it.
  • On a choice page, tapping a choice moves the check; closeOnSelect goes back too.
  • The theme row changes the app's scheme as you pick it; the text-size slider updates its sample live.

Accessibility

  • The chosen option reads "selected".
  • Locked rows report disabled, and their controls can't change.
  • The back button reads the previous screen's title.

Motion

  • Uses the toggle, select and drag motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Switches, the slider and the theme switch use their shared roles and respect Reduce Motion.

Performance

  • One ScrollView over the page's rows.

Notes for AI

  • Pass page: a pages id or a select row id.
  • Use settingsThemeRow, settingsTextSizeRow and settingsTimeRangeRow from settings-core for appearance and schedules.

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