Settings
A grouped settings screen with a profile row, search across every page, and sign-out behind a dialog.
npx @swipeui/cli add settings-groupedWhen to use it
- The main settings screen of an app: account, preferences, privacy, help and sign-out.
- Settings with sub-pages that people need to search.
When not to use it
- A couple of options inside another screen. Use List Section with Switch rows.
- Onboarding choices. Use a form or radio cards.
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-grouped- Adds
components/swipeui/settings/settings-grouped.tsx,components/swipeui/settings/use-settings-grouped.tsand 39 shared helpers. - Installs react-native-safe-area-context, clsx, tailwind-merge, react-native-svg, uniwind, 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
The kit is three screens that share one schema, one set of values and one adapter. Wrap the flow in SettingsProvider, then push Settings Detail for pages and choices, and Settings Account for the account page.
import { useState } from 'react';
import { Stack } from 'expo-router';
import { SettingsProvider } from '@/components/swipeui/settings/settings-core';
import type { SettingsValues } from '@/components/swipeui/settings/settings-core';
import { settingsData } from '@/lib/settings-data';
import { settingsAdapter } from '@/lib/settings-adapter';
export default function SettingsLayout() {
// Load and save these wherever you keep preferences.
const [values, setValues] = useState<SettingsValues>({});
return (
<SettingsProvider data={settingsData} adapter={settingsAdapter} values={values} onChange={(_id, _value, next) => setValues(next)}>
<Stack screenOptions={{ headerShown: false }} />
</SettingsProvider>
);
}import { router } from 'expo-router';
import { SettingsGrouped } from '@/components/swipeui/settings/settings-grouped';
const open = (page: string) =>
router.push(page === 'account' ? '/settings/account' : { pathname: '/settings/[page]', params: { page } });
export default function SettingsScreen() {
return <SettingsGrouped onOpenPage={open} onOpenSelect={open} onActionComplete={() => router.replace('/sign-in')} />;
}The screen never navigates on its own: it calls onOpenPage, onOpenSelect and onOpenProfile, so it works with either router. With no props it draws the sample schema through the mock adapter.
Sign-out uses Dialog, so wrap your app in OverlayProvider once.
The schema
SettingsData holds the main screen's sections, the sub-pages by id, the profile and the account. Each row has an id (its key in values), a title and a type:
navigateopens a page;detailcan be worked out from the values ((values) => values.notifications ? 'On' : 'Off'), andbadgeshows a count.toggleis a switch.selectis one choice:listopens a page of choices;segmentedpicks in the row.valueis read-only text, such as the version.destructiverunsadapter.action(id), after itsconfirmdialog when it has one.customdraws anything withrender({ value, setValue, values, set, disabled }).
dependsOn names a toggle that switches a row on and off: while it's off, the row dims and locks. keywords add words that search matches.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
data? | | | The schema: profile, sections and sub-pages. |
values? | | | Controlled values by row id. |
onChange? | | — | Reports each change with the full set of values. |
adapter? | | | Runs destructive rows such as Sign out. |
onOpenPage? | | — | A navigate row was pressed. Push the page (a |
onOpenSelect? | | — | A list select row was pressed. Push Settings Detail with this row id as its |
onOpenProfile? | | | The profile row was pressed. |
onActionComplete? | | — | A destructive row's action finished, such as signing out. |
onActionError? | | — | A destructive row's action failed. |
title? | | | The screen's title. |
header? | | |
|
largeTitle? | | | Start with the large title. Off keeps the compact bar. |
headerLeading? | | — | Content before the title in the drawn header, such as a Close button. |
headerTrailing? | | — | Content after the title in the drawn header. |
search? | | | A search field that filters every row on every page and highlights matches. |
showProfile? | | | The profile row at the top. |
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
- Search matches titles, subtitles, keywords and choice names on every page, and highlights the match. Results stay live, so a switch found by search toggles in place, and the result count is announced.
- The large title collapses as you scroll.
header="none"drops it so the screen sits under a native header. - Values are controlled with
valuesandonChange, shared throughSettingsProvider, or kept by the screen. - Every built-in word comes from
messages.
Behavior and gestures
- Typing in search filters rows from every page and highlights the match; results stay live, so a switch found by search toggles in place.
- Navigate rows open their page through onOpenPage; list choices open through onOpenSelect.
- Sign out asks in a dialog, then runs adapter.action.
Accessibility
- Rows read their title, value and badge together, such as "Notifications, On".
- The number of search results is announced as it changes.
- The large title is a header; section titles are headers.
Motion
- Uses the
toggle,selectandoverlaymotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The large title collapses on the UI thread; Reduce Motion swaps sizes without travel.
- Switches, choices and the dialog use their shared motion roles.
Performance
- One ScrollView; the schema is drawn directly, so keep it to a settings-sized list.
Notes for AI
- Pass data (SettingsData), values and onChange, or wrap the flow in SettingsProvider.
- Push Settings Detail for onOpenPage and onOpenSelect; route the account page to Settings Account.
- Needs OverlayProvider for the sign-out dialog.
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.