SwipeUI

Account settings

Edit the profile with a live username check, see the subscription, and delete the account with a hold.

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

  • An account page reached from settings: name, username, email, plan and deletion.
  • Any delete-account flow that needs a deliberate hold.

When not to use it

  • Sign-up or sign-in. Use the auth screens when they ship.

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

Usage

app/settings/account.tsx
import { router } from 'expo-router';
import { SettingsAccount } from '@/components/swipeui/settings/settings-account';

export default function AccountScreen() {
  return (
    <SettingsAccount
      onBack={router.back}
      onManageSubscription={() => router.push('/billing')}
      onDeleted={() => router.replace('/sign-in')}
    />
  );
}

The screen reads account from the schema. Fields stay above the keyboard through Form Scroll View, so wrap your app in FormProvider once.

The adapter

lib/settings-adapter.ts
import type { SettingsAdapter } from '@/components/swipeui/settings/settings-core';

export const settingsAdapter: SettingsAdapter = {
  action: async (id) => {
    if (id === 'sign-out') await auth.signOut();
  },
  checkUsername: async (username, signal) => {
    const response = await fetch(`/api/usernames/${encodeURIComponent(username)}`, { signal });
    return response.json(); // { available: boolean, suggestion?: string }
  },
  saveProfile: (profile, signal) => api.updateProfile(profile, { signal }),
  deleteAccount: (signal) => api.deleteAccount({ signal }),
};

Checks wait for typing to pause (usernameCheckDelay) and cancel the previous request through its AbortSignal. Any method may reject: Save shows the failure in its button and the hold offers a retry.

API reference

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

The schema; this screen reads its account.

adapter?SettingsAdapterthe provider's adapter, then the mock

Checks usernames, saves the profile and deletes the account.

onBack?(() => void)—

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

onSaved?((profile: SettingsProfileDraft) => void)—

The profile was saved.

onDeleted?(() => void)—

The account was deleted. Sign the person out and leave the screen here.

onManageSubscription?(() => void)—

The subscription row was pressed. Without it the row is plain.

checkUsername?booleantrue

Check new usernames through the adapter as people type.

usernameCheckDelay?number400

Pause after typing before a check, in milliseconds.

showSubscription?booleantrue when the account has one

The subscription section with its usage meter.

allowDelete?booleantrue

The delete-account flow at the bottom.

deleteHoldDuration?number1500

How long to hold before the account is deleted, in milliseconds.

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

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

headerTrailing?ReactNode—

Content after the title in the drawn header.

haptics?booleantrue

Haptics for saving, the check result and the hold.

motion?MotionOverridethe app feel

Local motion feel or spring override.

messages?Partial<SettingsAccountMessages>English

Built-in words.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Root style.

testID?string—

Root identifier. Parts append -name, -username, -email, -save, -subscription, -delete and -hold.

Composition and behavior

  • A username is checked only when it changes and fits the rule (3 to 20 letters, numbers, dots or underscores). A taken name shows the adapter's suggestion.
  • Save turns on only when something changed and everything is valid, and shows Saved when the adapter succeeds.
  • Delete account lists what goes (account.deletes), then a hold to confirm runs adapter.deleteAccount. Keep my account closes it.

Behavior and gestures

  • A new username is checked through adapter.checkUsername after typing pauses; a taken name offers the adapter's suggestion.
  • Save sends the edits through adapter.saveProfile and shows Saved in the button.
  • Delete account opens the consequences, then a hold to confirm runs adapter.deleteAccount.

Accessibility

  • Field messages are read with their fields; the check result is announced as it changes.
  • The hold has a named confirm action for screen readers.

Motion

  • Uses the layout and press motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • The delete confirmation fades in; Reduce Motion shows it at once.

Performance

  • Username checks wait for a pause and cancel the previous request.

Notes for AI

  • Implement checkUsername, saveProfile and deleteAccount in your adapter; they may reject.
  • Sign the person out in onDeleted.

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