Settings detail
Any settings sub-page from the schema, with master switches, live appearance controls and choice lists.
npx @swipeui/cli add settings-detailWhen 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.tsand 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 installso versions match your SDK.
Usage
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' });settingsThemeRowis a Theme Switch that changes the whole app as you pick.settingsTextSizeRowis a slider over five text sizes, with a live sample; its value is the step.settingsTimeRangeRowstores a From and To pair as oneHH:mm/HH:mmvalue.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
page | | — | A |
data? | | | The schema. |
values? | | | Controlled values by row id. |
onChange? | | — | Reports each change with the full set of values. |
adapter? | | | Runs destructive rows. |
onOpenPage? | | — | A navigate row on this page was pressed. |
onOpenSelect? | | — | A list select row on this page was pressed. |
onBack? | | — | Go back. Shows a back button in the drawn header. |
backLabel? | | | The back button's label, usually the previous screen's title. |
closeOnSelect? | | | Go back after picking a choice on a select page. |
onActionComplete? | | — | A destructive row's action finished. |
onActionError? | | — | A destructive row's action failed. |
header? | | |
|
largeTitle? | | | Start with a large title that collapses. |
headerTrailing? | | — | Content after the title in the drawn header. |
confirmDestructive? | | | Ask in a dialog before destructive rows that define |
haptics? | | | Haptics for switches, choices and actions. |
motion? | | | Local motion feel or spring override. |
messages? | | | Built-in words. |
className? | | — | Root classes. |
style? | | — | Root style. |
testID? | | — | Root identifier. Parts append |
Composition and behavior
- A row with
dependsOndims and locks while that toggle, or anything it depends on, is off. - On a choice page the check moves to the new choice.
closeOnSelectgoes 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,selectanddragmotion roles, so it follows your app's feel. Passmotionto 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 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.