v0.1 public beta early access on GitHub
Home / Screens / core-linked-accounts
Screen template

Linked accounts Screen

Connected sign-in providers with connect and disconnect actions.

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add core-linked-accounts
import { LinkedAccountsScreen } from "@/screens/core/linked-accounts";
Registry dependencies4
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
core/linked-accounts.tsxsource · yours to edit
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { BrandMark, Mount, Press, RowIcon, SEPARATOR_INSET, brandKey } from "../shared";

export interface LinkedAccount {
  id: string;
  provider: string;
  /** e.g. "amara.chen@gmail.com" */
  identity?: string;
  connected: boolean;
  /** e.g. "last used Tue" — shown under connected identities. */
  lastUsed?: string;
  /** Which logo to render — brand marks get real glyphs, the rest a row icon.
   *  Auto-inferred from the provider name when omitted. */
  brand?: string;
}

export interface LinkedAccountsScreenProps {
  accounts?: LinkedAccount[];
  onConnect?: (id: string) => void;
  onDisconnect?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_ACCOUNTS: LinkedAccount[] = [
  { id: "google", provider: "Google", identity: "amara.chen@gmail.com", connected: true, lastUsed: "Active now" },
  { id: "apple", provider: "Apple", identity: "a.chen@icloud.com", connected: true, lastUsed: "Last used Tue" },
  { id: "github", provider: "GitHub", connected: false },
  { id: "slack", provider: "Slack", connected: false },
  { id: "figma", provider: "Figma", connected: false },
  { id: "notion", provider: "Notion", connected: false },
];

/** Linked accounts — connected sign-in providers with connect/disconnect. */
export function LinkedAccountsScreen({
  accounts = DEFAULT_ACCOUNTS,
  onConnect,
  onDisconnect,
  onBack,
}: LinkedAccountsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [items, setItems] = React.useState(accounts);
  React.useEffect(() => setItems(accounts), [accounts]);

  const flip = (account: LinkedAccount) => () => {
    haptics.medium();
    setItems((prev) =>
      prev.map((a) =>
        a.id === account.id ? { ...a, connected: !a.connected } : a
      )
    );
    if (account.connected) {
      onDisconnect?.(account.id);
    } else {
      onConnect?.(account.id);
    }
  };

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back pill + hug-label title pill. */}
      <View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
        <View className="flex-row items-center gap-2">
          <Glass
            effect="regular"
            className="h-11 w-11 items-center justify-center rounded-full"
          >
            <Button
              variant="ghost"
              size="icon"
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityLabel="Go back"
              className="h-9 w-9"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Button>
          </Glass>
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <Glass
            effect="regular"
            className="h-11 flex-row items-center justify-center rounded-full px-5"
          >
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Linked accounts
            </Text>
          </Glass>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
      >
        <List inset glass>
          <List.Section title="Sign-in providers">
            {items.map((account, ii) => (
              <React.Fragment key={account.id}>
                {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                <List.Item
                  title={account.provider}
                  subtitle={
                    account.connected
                      ? [account.identity ?? "Connected", account.lastUsed]
                          .filter(Boolean)
                          .join(" · ")
                      : "Not connected"
                  }
                  leading={
                    (() => {
                      const mark = account.brand ?? brandKey(account.provider);
                      return mark ? (
                        <BrandMark brand={mark} size={32} />
                      ) : (
                        <RowIcon name="link" tone="gray" />
                      );
                    })()
                  }
                  trailing={
                    <Button
                      variant="secondary"
                      size="sm"
                      haptic="medium"
                      onPress={flip(account)}
                      accessibilityLabel={
                        account.connected
                          ? `Disconnect ${account.provider}`
                          : `Connect ${account.provider}`
                      }
                      className={account.connected ? undefined : "bg-[#BEF04C]"}
                      textClassName={account.connected ? undefined : "text-[#1B1B26]"}
                    >
                      {account.connected ? "Disconnect" : "Connect"}
                    </Button>
                  }
                  className="py-3"
                />
              </React.Fragment>
            ))}
          </List.Section>
        </List>

        <Text variant="small" className="px-8 pt-2 text-muted-foreground">
          Linked providers can sign you in — disconnecting one keeps your
          account and data. You can always reconnect later.
        </Text>

        {/* Sessions — the security context that belongs under providers. */}
        <Mount className="pt-7">
          <List inset glass>
            <List.Section title="Recent sessions">
              <List.Item
                title="This device — MacBook Pro"
                subtitle="Lisbon, PT · Active now"
                leading={<RowIcon name="settings" tone="green" />}
                trailing={
                  <View className="rounded-full bg-success/15 px-2 py-0.5">
                    <Text className="text-[10px] font-medium text-success">Current</Text>
                  </View>
                }
                className="py-3"
              />
              <List.Separator className={SEPARATOR_INSET} />
              <List.Item
                title="iPhone 15 Pro"
                subtitle="Lisbon, PT · Yesterday 9:14 PM"
                leading={<RowIcon name="phone" tone="blue" />}
                showChevron
                haptic="light"
                className="py-3"
              />
            </List.Section>
          </List>
        </Mount>
        {/* Sync state — linked-account pages answer "is this live right now". */}
        <View className="mx-6 mt-3 flex-row items-center gap-2 overflow-hidden rounded-2xl px-4 py-3">
          <Glass interactive effect="clear" sheen={0.45} className="absolute inset-0 rounded-2xl" pointerEvents="none" />
          <View className="h-2 w-2 rounded-full bg-success" />
          <Text variant="muted" className="flex-1 text-xs">
            Connections healthy · last checked just now
          </Text>
          <Press haptic="light" accessibilityRole="button" accessibilityLabel="Refresh connections">
            <Icon name="refresh" size="sm" color="mutedForeground" />
          </Press>
        </View>
      </ScrollView>
    </SafeAreaView>
  );
}
LinkedAccountsScreen.displayName = "LinkedAccountsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Linked accounts Screen" screen in React Native using LumioUI.

Goal: Connected sign-in providers with connect and disconnect actions. Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.

## Setup

Fastest path — install the screen plus its component deps:

```bash
npx lumioui add core-linked-accounts
```

Or pull just the components: `npx lumioui add button icon list text`

Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*

Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.

## Components — how, where, when

### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×2

### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×2

### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×2

### `text` — Themed type scale from caption to display.
- `<Text>` ×4

## Conventions (non-negotiable)

- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.

## Deliverable

One file: `screens/core/linked-accounts.tsx` exporting LinkedAccountsScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.

## Reference implementation

The LumioUI source for this screen — reproduce it faithfully:

```tsx
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { BrandMark, Mount, Press, RowIcon, SEPARATOR_INSET, brandKey } from "../shared";

export interface LinkedAccount {
  id: string;
  provider: string;
  /** e.g. "amara.chen@gmail.com" */
  identity?: string;
  connected: boolean;
  /** e.g. "last used Tue" — shown under connected identities. */
  lastUsed?: string;
  /** Which logo to render — brand marks get real glyphs, the rest a row icon.
   *  Auto-inferred from the provider name when omitted. */
  brand?: string;
}

export interface LinkedAccountsScreenProps {
  accounts?: LinkedAccount[];
  onConnect?: (id: string) => void;
  onDisconnect?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_ACCOUNTS: LinkedAccount[] = [
  { id: "google", provider: "Google", identity: "amara.chen@gmail.com", connected: true, lastUsed: "Active now" },
  { id: "apple", provider: "Apple", identity: "a.chen@icloud.com", connected: true, lastUsed: "Last used Tue" },
  { id: "github", provider: "GitHub", connected: false },
  { id: "slack", provider: "Slack", connected: false },
  { id: "figma", provider: "Figma", connected: false },
  { id: "notion", provider: "Notion", connected: false },
];

/** Linked accounts — connected sign-in providers with connect/disconnect. */
export function LinkedAccountsScreen({
  accounts = DEFAULT_ACCOUNTS,
  onConnect,
  onDisconnect,
  onBack,
}: LinkedAccountsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [items, setItems] = React.useState(accounts);
  React.useEffect(() => setItems(accounts), [accounts]);

  const flip = (account: LinkedAccount) => () => {
    haptics.medium();
    setItems((prev) =>
      prev.map((a) =>
        a.id === account.id ? { ...a, connected: !a.connected } : a
      )
    );
    if (account.connected) {
      onDisconnect?.(account.id);
    } else {
      onConnect?.(account.id);
    }
  };

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back pill + hug-label title pill. */}
      <View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
        <View className="flex-row items-center gap-2">
          <Glass
            effect="regular"
            className="h-11 w-11 items-center justify-center rounded-full"
          >
            <Button
              variant="ghost"
              size="icon"
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityLabel="Go back"
              className="h-9 w-9"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Button>
          </Glass>
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <Glass
            effect="regular"
            className="h-11 flex-row items-center justify-center rounded-full px-5"
          >
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Linked accounts
            </Text>
          </Glass>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
      >
        <List inset glass>
          <List.Section title="Sign-in providers">
            {items.map((account, ii) => (
              <React.Fragment key={account.id}>
                {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                <List.Item
                  title={account.provider}
                  subtitle={
                    account.connected
                      ? [account.identity ?? "Connected", account.lastUsed]
                          .filter(Boolean)
                          .join(" · ")
                      : "Not connected"
                  }
                  leading={
                    (() => {
                      const mark = account.brand ?? brandKey(account.provider);
                      return mark ? (
                        <BrandMark brand={mark} size={32} />
                      ) : (
                        <RowIcon name="link" tone="gray" />
                      );
                    })()
                  }
                  trailing={
                    <Button
                      variant="secondary"
                      size="sm"
                      haptic="medium"
                      onPress={flip(account)}
                      accessibilityLabel={
                        account.connected
                          ? `Disconnect ${account.provider}`
                          : `Connect ${account.provider}`
                      }
                      className={account.connected ? undefined : "bg-[#BEF04C]"}
                      textClassName={account.connected ? undefined : "text-[#1B1B26]"}
                    >
                      {account.connected ? "Disconnect" : "Connect"}
                    </Button>
                  }
                  className="py-3"
                />
              </React.Fragment>
            ))}
          </List.Section>
        </List>

        <Text variant="small" className="px-8 pt-2 text-muted-foreground">
          Linked providers can sign you in — disconnecting one keeps your
          account and data. You can always reconnect later.
        </Text>

        {/* Sessions — the security context that belongs under providers. */}
        <Mount className="pt-7">
          <List inset glass>
            <List.Section title="Recent sessions">
              <List.Item
                title="This device — MacBook Pro"
                subtitle="Lisbon, PT · Active now"
                leading={<RowIcon name="settings" tone="green" />}
                trailing={
                  <View className="rounded-full bg-success/15 px-2 py-0.5">
                    <Text className="text-[10px] font-medium text-success">Current</Text>
                  </View>
                }
                className="py-3"
              />
              <List.Separator className={SEPARATOR_INSET} />
              <List.Item
                title="iPhone 15 Pro"
                subtitle="Lisbon, PT · Yesterday 9:14 PM"
                leading={<RowIcon name="phone" tone="blue" />}
                showChevron
                haptic="light"
                className="py-3"
              />
            </List.Section>
          </List>
        </Mount>
        {/* Sync state — linked-account pages answer "is this live right now". */}
        <View className="mx-6 mt-3 flex-row items-center gap-2 overflow-hidden rounded-2xl px-4 py-3">
          <Glass interactive effect="clear" sheen={0.45} className="absolute inset-0 rounded-2xl" pointerEvents="none" />
          <View className="h-2 w-2 rounded-full bg-success" />
          <Text variant="muted" className="flex-1 text-xs">
            Connections healthy · last checked just now
          </Text>
          <Press haptic="light" accessibilityRole="button" accessibilityLabel="Refresh connections">
            <Icon name="refresh" size="sm" color="mutedForeground" />
          </Press>
        </View>
      </ScrollView>
    </SafeAreaView>
  );
}
LinkedAccountsScreen.displayName = "LinkedAccountsScreen";
```

Screen: https://lumioui.dev/screens/core-linked-accounts
iPhone 17 · iOS
9:41
Live preview — the real screen via Expo Web · open full ↗