SwipeUI

Settings

A grouped settings screen with a profile row, search across every page, and sign-out behind a dialog.

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

  • 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.ts and 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 install so 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.

app/settings/_layout.tsx
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>
  );
}
app/settings/index.tsx
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:

  • navigate opens a page; detail can be worked out from the values ((values) => values.notifications ? 'On' : 'Off'), and badge shows a count.
  • toggle is a switch.
  • select is one choice: list opens a page of choices; segmented picks in the row.
  • value is read-only text, such as the version.
  • destructive runs adapter.action(id), after its confirm dialog when it has one.
  • custom draws anything with render({ 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

PropTypeDefaultDescription
data?SettingsDatathe provider's data, then the sample

The schema: profile, sections and sub-pages.

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 such as Sign out.

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

A navigate row was pressed. Push the page (a pages id, or a screen you own such as account).

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

A list select row was pressed. Push Settings Detail with this row id as its page.

onOpenProfile?(() => void)opens the `account` page through `onOpenPage`

The profile row was pressed.

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

A destructive row's action finished, such as signing out.

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

A destructive row's action failed.

title?stringthe schema's title, then 'Settings'

The screen's title.

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

default draws a large title that collapses as you scroll; none sits under a native header.

largeTitle?booleantrue

Start with the large title. Off keeps the compact bar.

headerLeading?ReactNode—

Content before the title in the drawn header, such as a Close button.

headerTrailing?ReactNode—

Content after the title in the drawn header.

search?booleantrue

A search field that filters every row on every page and highlights matches.

showProfile?booleantrue when the schema has a profile

The profile row at the top.

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 -search, -profile, -row-<id> and -section-<id>.

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 values and onChange, shared through SettingsProvider, 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, select and overlay motion roles, so it follows your app's feel. Pass motion to 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 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