v0.1 public beta early access on GitHub
Home / Screens / finance-card-details
Screen template

Card Details Screen

Physical card render with masked number, freeze switch, spending-limit rows with a usage bar, and recent card transactions

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add finance-card-details
import { CardDetailsScreen } from "@/screens/finance/card-details";
Registry dependencies6
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
finance/card-details.tsxsource · yours to edit
import * as React from "react";
import { useState } from "react";
import { View, ScrollView, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Card, Glass, Icon, Progress, Separator, Switch, Text, type IconName } from "@lumioui/ui";
import { AnimatedPressable, cn, useHaptic, usePressAnimation, type ColorTokens } from "@lumioui/core";

import { BrandMark, CardBrandMark, LumioMark, Mount, Press, brandKey } from "../shared";
export interface PaymentCard {
  id: string;
  /** Printed cardholder name — "AMARA CHEN". */
  holder: string;
  /** Last four digits — the only digits ever rendered. */
  last4: string;
  /** Network wordmark rendered as text — "VISA", "Mastercard". */
  network: string;
  /** "09/28". */
  expires: string;
}

export interface CardTransaction {
  id: string;
  merchant: string;
  category: string;
  /** Positive = credit (refund), negative = debit. */
  amount: number;
  date: string;
  icon?: IconName;
  /** Soft-tint tile background class. */
  tileBg?: string;
  /** Icon tint token — pairs with `tileBg`. */
  tint?: keyof ColorTokens;
}

export interface CardDetailsScreenProps {
  card?: PaymentCard;
  currency?: string;
  /** Controlled frozen state. Omit + use defaultFrozen for uncontrolled. */
  frozen?: boolean;
  defaultFrozen?: boolean;
  onFrozenChange?: (frozen: boolean) => void;
  /** Monthly cap + what has been spent against it. */
  monthlyLimit?: number;
  spentThisMonth?: number;
  /** Daily ATM cap shown on the withdrawals row. */
  atmDailyLimit?: number;
  transactions?: CardTransaction[];
  onBack?: () => void;
  onMore?: () => void;
  onLimitPress?: (key: "monthly" | "online" | "atm") => void;
  onTransactionPress?: (transaction: CardTransaction) => void;
}

const DEFAULT_CARD: PaymentCard = {
  id: "card-1",
  holder: "AMARA CHEN",
  last4: "4821",
  network: "VISA",
  expires: "09/28",
};

const DEFAULT_TRANSACTIONS: CardTransaction[] = [
  { id: "t1", merchant: "DoorDash", category: "Food & dining", amount: -18.5, date: "Today" },
  { id: "t2", merchant: "Starbucks", category: "Food & dining", amount: -6.4, date: "Today" },
  { id: "t3", merchant: "Metro Transit", category: "Transport", amount: -2.75, date: "Yesterday", icon: "tram-front", tileBg: "bg-chart-2/15", tint: "chart2" },
  { id: "t4", merchant: "Figma — Pro plan", category: "Subscriptions", amount: -12, date: "Sep 12" },
];

function fmt(amount: number, currency: string) {
  const abs = Math.abs(amount).toLocaleString("en-US", {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2,
  });
  return `${amount < 0 ? "−" : "+"}${currency}${abs}`;
}

/** Control row — tinted leading glyph, title/subtitle, trailing slot. */
function ControlRow({
  icon,
  title,
  subtitle,
  trailing,
  onPress,
  tileBg = "bg-primary/15",
  tint = "primary",
}: {
  icon: IconName;
  title: string;
  subtitle?: string;
  trailing?: React.ReactNode;
  onPress?: () => void;
  tileBg?: string;
  tint?: keyof ColorTokens;
}) {
  const haptics = useHaptic();
  const press = usePressAnimation({ pressedScale: 0.98, pressedOpacity: 0.75, fast: true });
  return (
    <AnimatedPressable
      onPress={
        onPress
          ? () => {
              haptics.light();
              onPress();
            }
          : undefined
      }
      onPressIn={press.onPressIn}
      onPressOut={press.onPressOut}
      style={press.animatedStyle}
      disabled={!onPress}
      accessibilityRole={onPress ? "button" : "none"}
      accessibilityLabel={subtitle ? `${title}, ${subtitle}` : title}
      className="min-h-11 w-full flex-row items-center gap-3 p-3"
    >
      <View
        className={`h-9 w-9 items-center justify-center rounded-2xl ${tileBg}`}
        accessible={false}
      >
        <Icon name={icon} size="sm" color={tint} />
      </View>
      <View className="flex-1 gap-0.5">
        <Text variant="small" numberOfLines={1} className="font-medium">
          {title}
        </Text>
        {subtitle ? (
          <Text variant="muted" numberOfLines={1} className="text-xs">
            {subtitle}
          </Text>
        ) : null}
      </View>
      {trailing ??
        (onPress ? (
          <Icon name="chevron-right" size="sm" color="mutedForeground" />
        ) : null)}
    </AnimatedPressable>
  );
}

/** Transaction row — tinted squircle glyph + signed amount, dips on press. */
function CardTxRow({
  tx,
  currency,
  onPress,
}: {
  tx: CardTransaction;
  currency: string;
  onPress?: (t: CardTransaction) => void;
}) {
  const haptics = useHaptic();
  const press = usePressAnimation({ pressedScale: 0.98, pressedOpacity: 0.75, fast: true });
  return (
    <AnimatedPressable
      onPress={() => {
        haptics.light();
        onPress?.(tx);
      }}
      onPressIn={press.onPressIn}
      onPressOut={press.onPressOut}
      style={press.animatedStyle}
      accessibilityRole="button"
      accessibilityLabel={`${tx.merchant}, ${fmt(tx.amount, currency)}, ${tx.date}`}
      className="flex-row items-center gap-3 p-3"
    >
      {(() => {
        const mark = brandKey(tx.merchant);
        return mark ? (
          <BrandMark brand={mark} size={44} />
        ) : (
          <View
            className={`h-11 w-11 items-center justify-center rounded-2xl ${
              tx.tileBg ?? "bg-primary/15"
            }`}
          >
            <Icon name={tx.icon ?? "credit-card"} size="sm" color={tx.tint ?? "primary"} />
          </View>
        );
      })()}
      <View className="flex-1">
        <Text variant="small" numberOfLines={1}>
          {tx.merchant}
        </Text>
        <Text variant="muted">
          {tx.category} · {tx.date}
        </Text>
      </View>
      <Text
        variant="small"
        className={`tabular-nums font-semibold ${tx.amount >= 0 ? "text-success" : ""}`}
      >
        {fmt(tx.amount, currency).split(".")[0]}
        <Text variant="small" className={`tabular-nums text-xs ${tx.amount >= 0 ? "text-success" : "text-muted-foreground"}`}>
          .{fmt(tx.amount, currency).split(".")[1] ?? "00"}
        </Text>
      </Text>
    </AnimatedPressable>
  );
}

/** Card details — physical-card render with a freeze switch, spending
 *  limits, and the transactions that ran on this card. */
export function CardDetailsScreen({
  card = DEFAULT_CARD,
  currency = "$",
  frozen,
  defaultFrozen = false,
  onFrozenChange,
  monthlyLimit = 2000,
  spentThisMonth = 890.32,
  atmDailyLimit = 400,
  transactions = DEFAULT_TRANSACTIONS,
  onBack,
  onMore,
  onLimitPress,
  onTransactionPress,
}: CardDetailsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [uncontrolledFrozen, setUncontrolledFrozen] = useState(defaultFrozen);
  // Resolve controlled vs uncontrolled during render, never in an effect.
  const isFrozen = frozen ?? uncontrolledFrozen;

  const toggleFrozen = (next: boolean) => {
    if (frozen === undefined) setUncontrolledFrozen(next);
    onFrozenChange?.(next);
  };

  const limitPct = Math.min(100, (spentThisMonth / Math.max(monthlyLimit, 1)) * 100);

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc, centered title pill, overflow disc. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onMore?.()}
              accessibilityRole="button"
              accessibilityLabel="Card options"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="more-vertical" size="md" color="foreground" />
            </Press>
          </Glass>
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Card details
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerClassName="gap-5 px-6"
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 24 }}
      >
        {/* Card face — 85.6×54mm aspect, masked PAN, tonal decorations.
            No gradient dep: stacked translucent discs stand in for a
            sheen (same trick as StoryChrome's scrim strips). */}
        <Mount>
          <View
            accessible
            accessibilityRole="text"
            accessibilityLabel={`${card.network} card ending in ${card.last4}${isFrozen ? ", frozen" : ""}`}
            className={cn(
              "aspect-[1.586] w-full overflow-hidden rounded-2xl bg-[#1B1B26] p-5",
              isFrozen && "opacity-60"
            )}
          >
            {/* Decoration — clipped by the card's overflow-hidden. */}
            <View className="absolute -right-10 -top-16 h-48 w-48 rounded-full bg-white/10" accessible={false} />
            <View className="absolute -bottom-20 -left-12 h-44 w-44 rounded-full bg-white/[0.07]" accessible={false} />

            <View className="flex-1 justify-between">
              <View className="flex-row items-center justify-between">
                {/* Chip + contactless — a rotated wifi glyph is the
                    near-field mark every card render uses. */}
                <View className="flex-row items-center gap-2">
                  <View className="h-7 w-10 rounded-md bg-amber-200/90" />
                  <View className="rotate-90">
                    <Icon name="wifi" size="sm" color="#FFFFFF" />
                  </View>
                </View>
                {isFrozen ? (
                  <View className="flex-row items-center gap-1 rounded-full bg-white/15 px-2.5 py-1">
                    <Icon name="lock" size="sm" color="#FFFFFF" />
                    <Text className="text-xs font-semibold text-white">
                      Frozen
                    </Text>
                  </View>
                ) : null}
              </View>

              <Text
                className="font-mono text-xl font-semibold tracking-[0.18em] text-white"
                accessibilityElementsHidden
              >
                •••• •••• •••• {card.last4}
              </Text>

              <View className="flex-row items-end justify-between">
                <View>
                  <Text className="text-[10px] uppercase tracking-wider text-white/60">
                    Card holder
                  </Text>
                  <Text className="text-sm font-semibold uppercase tracking-wide text-white">
                    {card.holder}
                  </Text>
                </View>
                <View className="items-end">
                  <Text className="text-[10px] uppercase tracking-wider text-white/60">
                    Expires
                  </Text>
                  <Text className="text-sm font-semibold text-white tabular-nums">
                    {card.expires}
                  </Text>
                </View>
                <CardBrandMark network={card.network} size={26} />
              </View>
            </View>
          </View>
        </Mount>

        {/* Freeze — the one control every card screen leads with. */}
        <Mount delay={80}>
          <Card variant="elevated" className="rounded-2xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="p-2">
              <ControlRow
                icon="lock"
                tileBg="bg-chart-2/15"
                tint="chart2"
                title="Freeze card"
                subtitle={isFrozen ? "Frozen — can't be used" : "Instantly disable this card"}
                trailing={
                  <Switch
                    checked={isFrozen}
                    onCheckedChange={toggleFrozen}
                    accessibilityLabel="Freeze card"
                  />
                }
              />
            </Card.Content>
          </Card>
        </Mount>

        {/* Limits — chevron rows with live values; monthly gets a bar. */}
        <Mount delay={160} className="gap-2">
          <Text variant="large" accessibilityRole="header">
            Limits
          </Text>
          <Card variant="elevated" className="rounded-2xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="gap-1 p-2">
              <ControlRow
                icon="credit-card"
                tileBg="bg-primary/15"
                tint="primary"
                title="Monthly spending"
                subtitle={`${currency}${spentThisMonth.toLocaleString("en-US", { minimumFractionDigits: 2 })} of ${currency}${monthlyLimit.toLocaleString("en-US")} used`}
                onPress={() => onLimitPress?.("monthly")}
              />
              <View className="px-3 pb-2">
                <Progress
                  value={limitPct}
                  accessibilityLabel={`${Math.round(limitPct)}% of monthly limit used`}
                />
              </View>
              <View className="px-3">
                <Separator />
              </View>
              <ControlRow
                icon="globe"
                tileBg="bg-chart-3/15"
                tint="chart3"
                title="Online payments"
                subtitle="Enabled"
                onPress={() => onLimitPress?.("online")}
              />
              <View className="px-3">
                <Separator />
              </View>
              <ControlRow
                icon="map-pin"
                tileBg="bg-chart-5/15"
                tint="chart5"
                title="ATM withdrawals"
                subtitle={`${currency}${atmDailyLimit.toLocaleString("en-US")} per day`}
                onPress={() => onLimitPress?.("atm")}
              />
            </Card.Content>
          </Card>
        </Mount>

        {/* Recent activity on this card. */}
        <Mount delay={240} className="gap-2">
          <Text variant="large" accessibilityRole="header">
            Recent on this card
          </Text>
          <Card variant="elevated" className="rounded-2xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="p-2">
              {transactions.map((tx, i) => (
                <React.Fragment key={tx.id}>
                  {i > 0 ? (
                    <View className="px-3">
                      <Separator />
                    </View>
                  ) : null}
                  <CardTxRow
                    tx={tx}
                    currency={currency}
                    onPress={onTransactionPress}
                  />
                </React.Fragment>
              ))}
            </Card.Content>
          </Card>
        </Mount>

        {/* Lost card — the escape hatch every card screen owes you. */}
        <Mount delay={200}>
          <Pressable
            onPress={() => haptics.light()}
            accessibilityRole="button"
            className="items-center py-3"
          >
            <Text className="text-sm font-medium text-destructive">
              Report lost or stolen
            </Text>
          </Pressable>
        </Mount>
      </ScrollView>
    </SafeAreaView>
  );
}
CardDetailsScreen.displayName = "CardDetailsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Card Details Screen" screen in React Native using LumioUI.

Goal: Physical card render with masked number, freeze switch, spending-limit rows with a usage bar, and recent card transactions 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 finance-card-details
```

Or pull just the components: `npx lumioui add card icon progress separator switch 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

### `card` — Compound surface — header, title, content and footer slots.
- `<Card>` ×3

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

### `progress` — Animated fill bar with indeterminate sweep mode.
- `<Progress>` ×1

### `separator` — Hairline rule with orientation and spacing control.
- `<Separator>` ×3

### `switch` — iOS-size toggle with spring thumb and haptics.
- `<Switch>` ×1

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

## 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/finance/card-details.tsx` exporting CardDetailsScreen. 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 { useState } from "react";
import { View, ScrollView, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Card, Glass, Icon, Progress, Separator, Switch, Text, type IconName } from "@lumioui/ui";
import { AnimatedPressable, cn, useHaptic, usePressAnimation, type ColorTokens } from "@lumioui/core";

import { BrandMark, CardBrandMark, LumioMark, Mount, Press, brandKey } from "../shared";
export interface PaymentCard {
  id: string;
  /** Printed cardholder name — "AMARA CHEN". */
  holder: string;
  /** Last four digits — the only digits ever rendered. */
  last4: string;
  /** Network wordmark rendered as text — "VISA", "Mastercard". */
  network: string;
  /** "09/28". */
  expires: string;
}

export interface CardTransaction {
  id: string;
  merchant: string;
  category: string;
  /** Positive = credit (refund), negative = debit. */
  amount: number;
  date: string;
  icon?: IconName;
  /** Soft-tint tile background class. */
  tileBg?: string;
  /** Icon tint token — pairs with `tileBg`. */
  tint?: keyof ColorTokens;
}

export interface CardDetailsScreenProps {
  card?: PaymentCard;
  currency?: string;
  /** Controlled frozen state. Omit + use defaultFrozen for uncontrolled. */
  frozen?: boolean;
  defaultFrozen?: boolean;
  onFrozenChange?: (frozen: boolean) => void;
  /** Monthly cap + what has been spent against it. */
  monthlyLimit?: number;
  spentThisMonth?: number;
  /** Daily ATM cap shown on the withdrawals row. */
  atmDailyLimit?: number;
  transactions?: CardTransaction[];
  onBack?: () => void;
  onMore?: () => void;
  onLimitPress?: (key: "monthly" | "online" | "atm") => void;
  onTransactionPress?: (transaction: CardTransaction) => void;
}

const DEFAULT_CARD: PaymentCard = {
  id: "card-1",
  holder: "AMARA CHEN",
  last4: "4821",
  network: "VISA",
  expires: "09/28",
};

const DEFAULT_TRANSACTIONS: CardTransaction[] = [
  { id: "t1", merchant: "DoorDash", category: "Food & dining", amount: -18.5, date: "Today" },
  { id: "t2", merchant: "Starbucks", category: "Food & dining", amount: -6.4, date: "Today" },
  { id: "t3", merchant: "Metro Transit", category: "Transport", amount: -2.75, date: "Yesterday", icon: "tram-front", tileBg: "bg-chart-2/15", tint: "chart2" },
  { id: "t4", merchant: "Figma — Pro plan", category: "Subscriptions", amount: -12, date: "Sep 12" },
];

function fmt(amount: number, currency: string) {
  const abs = Math.abs(amount).toLocaleString("en-US", {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2,
  });
  return `${amount < 0 ? "−" : "+"}${currency}${abs}`;
}

/** Control row — tinted leading glyph, title/subtitle, trailing slot. */
function ControlRow({
  icon,
  title,
  subtitle,
  trailing,
  onPress,
  tileBg = "bg-primary/15",
  tint = "primary",
}: {
  icon: IconName;
  title: string;
  subtitle?: string;
  trailing?: React.ReactNode;
  onPress?: () => void;
  tileBg?: string;
  tint?: keyof ColorTokens;
}) {
  const haptics = useHaptic();
  const press = usePressAnimation({ pressedScale: 0.98, pressedOpacity: 0.75, fast: true });
  return (
    <AnimatedPressable
      onPress={
        onPress
          ? () => {
              haptics.light();
              onPress();
            }
          : undefined
      }
      onPressIn={press.onPressIn}
      onPressOut={press.onPressOut}
      style={press.animatedStyle}
      disabled={!onPress}
      accessibilityRole={onPress ? "button" : "none"}
      accessibilityLabel={subtitle ? `${title}, ${subtitle}` : title}
      className="min-h-11 w-full flex-row items-center gap-3 p-3"
    >
      <View
        className={`h-9 w-9 items-center justify-center rounded-2xl ${tileBg}`}
        accessible={false}
      >
        <Icon name={icon} size="sm" color={tint} />
      </View>
      <View className="flex-1 gap-0.5">
        <Text variant="small" numberOfLines={1} className="font-medium">
          {title}
        </Text>
        {subtitle ? (
          <Text variant="muted" numberOfLines={1} className="text-xs">
            {subtitle}
          </Text>
        ) : null}
      </View>
      {trailing ??
        (onPress ? (
          <Icon name="chevron-right" size="sm" color="mutedForeground" />
        ) : null)}
    </AnimatedPressable>
  );
}

/** Transaction row — tinted squircle glyph + signed amount, dips on press. */
function CardTxRow({
  tx,
  currency,
  onPress,
}: {
  tx: CardTransaction;
  currency: string;
  onPress?: (t: CardTransaction) => void;
}) {
  const haptics = useHaptic();
  const press = usePressAnimation({ pressedScale: 0.98, pressedOpacity: 0.75, fast: true });
  return (
    <AnimatedPressable
      onPress={() => {
        haptics.light();
        onPress?.(tx);
      }}
      onPressIn={press.onPressIn}
      onPressOut={press.onPressOut}
      style={press.animatedStyle}
      accessibilityRole="button"
      accessibilityLabel={`${tx.merchant}, ${fmt(tx.amount, currency)}, ${tx.date}`}
      className="flex-row items-center gap-3 p-3"
    >
      {(() => {
        const mark = brandKey(tx.merchant);
        return mark ? (
          <BrandMark brand={mark} size={44} />
        ) : (
          <View
            className={`h-11 w-11 items-center justify-center rounded-2xl ${
              tx.tileBg ?? "bg-primary/15"
            }`}
          >
            <Icon name={tx.icon ?? "credit-card"} size="sm" color={tx.tint ?? "primary"} />
          </View>
        );
      })()}
      <View className="flex-1">
        <Text variant="small" numberOfLines={1}>
          {tx.merchant}
        </Text>
        <Text variant="muted">
          {tx.category} · {tx.date}
        </Text>
      </View>
      <Text
        variant="small"
        className={`tabular-nums font-semibold ${tx.amount >= 0 ? "text-success" : ""}`}
      >
        {fmt(tx.amount, currency).split(".")[0]}
        <Text variant="small" className={`tabular-nums text-xs ${tx.amount >= 0 ? "text-success" : "text-muted-foreground"}`}>
          .{fmt(tx.amount, currency).split(".")[1] ?? "00"}
        </Text>
      </Text>
    </AnimatedPressable>
  );
}

/** Card details — physical-card render with a freeze switch, spending
 *  limits, and the transactions that ran on this card. */
export function CardDetailsScreen({
  card = DEFAULT_CARD,
  currency = "$",
  frozen,
  defaultFrozen = false,
  onFrozenChange,
  monthlyLimit = 2000,
  spentThisMonth = 890.32,
  atmDailyLimit = 400,
  transactions = DEFAULT_TRANSACTIONS,
  onBack,
  onMore,
  onLimitPress,
  onTransactionPress,
}: CardDetailsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [uncontrolledFrozen, setUncontrolledFrozen] = useState(defaultFrozen);
  // Resolve controlled vs uncontrolled during render, never in an effect.
  const isFrozen = frozen ?? uncontrolledFrozen;

  const toggleFrozen = (next: boolean) => {
    if (frozen === undefined) setUncontrolledFrozen(next);
    onFrozenChange?.(next);
  };

  const limitPct = Math.min(100, (spentThisMonth / Math.max(monthlyLimit, 1)) * 100);

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc, centered title pill, overflow disc. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onMore?.()}
              accessibilityRole="button"
              accessibilityLabel="Card options"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="more-vertical" size="md" color="foreground" />
            </Press>
          </Glass>
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Card details
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerClassName="gap-5 px-6"
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 24 }}
      >
        {/* Card face — 85.6×54mm aspect, masked PAN, tonal decorations.
            No gradient dep: stacked translucent discs stand in for a
            sheen (same trick as StoryChrome's scrim strips). */}
        <Mount>
          <View
            accessible
            accessibilityRole="text"
            accessibilityLabel={`${card.network} card ending in ${card.last4}${isFrozen ? ", frozen" : ""}`}
            className={cn(
              "aspect-[1.586] w-full overflow-hidden rounded-2xl bg-[#1B1B26] p-5",
              isFrozen && "opacity-60"
            )}
          >
            {/* Decoration — clipped by the card's overflow-hidden. */}
            <View className="absolute -right-10 -top-16 h-48 w-48 rounded-full bg-white/10" accessible={false} />
            <View className="absolute -bottom-20 -left-12 h-44 w-44 rounded-full bg-white/[0.07]" accessible={false} />

            <View className="flex-1 justify-between">
              <View className="flex-row items-center justify-between">
                {/* Chip + contactless — a rotated wifi glyph is the
                    near-field mark every card render uses. */}
                <View className="flex-row items-center gap-2">
                  <View className="h-7 w-10 rounded-md bg-amber-200/90" />
                  <View className="rotate-90">
                    <Icon name="wifi" size="sm" color="#FFFFFF" />
                  </View>
                </View>
                {isFrozen ? (
                  <View className="flex-row items-center gap-1 rounded-full bg-white/15 px-2.5 py-1">
                    <Icon name="lock" size="sm" color="#FFFFFF" />
                    <Text className="text-xs font-semibold text-white">
                      Frozen
                    </Text>
                  </View>
                ) : null}
              </View>

              <Text
                className="font-mono text-xl font-semibold tracking-[0.18em] text-white"
                accessibilityElementsHidden
              >
                •••• •••• •••• {card.last4}
              </Text>

              <View className="flex-row items-end justify-between">
                <View>
                  <Text className="text-[10px] uppercase tracking-wider text-white/60">
                    Card holder
                  </Text>
                  <Text className="text-sm font-semibold uppercase tracking-wide text-white">
                    {card.holder}
                  </Text>
                </View>
                <View className="items-end">
                  <Text className="text-[10px] uppercase tracking-wider text-white/60">
                    Expires
                  </Text>
                  <Text className="text-sm font-semibold text-white tabular-nums">
                    {card.expires}
                  </Text>
                </View>
                <CardBrandMark network={card.network} size={26} />
              </View>
            </View>
          </View>
        </Mount>

        {/* Freeze — the one control every card screen leads with. */}
        <Mount delay={80}>
          <Card variant="elevated" className="rounded-2xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="p-2">
              <ControlRow
                icon="lock"
                tileBg="bg-chart-2/15"
                tint="chart2"
                title="Freeze card"
                subtitle={isFrozen ? "Frozen — can't be used" : "Instantly disable this card"}
                trailing={
                  <Switch
                    checked={isFrozen}
                    onCheckedChange={toggleFrozen}
                    accessibilityLabel="Freeze card"
                  />
                }
              />
            </Card.Content>
          </Card>
        </Mount>

        {/* Limits — chevron rows with live values; monthly gets a bar. */}
        <Mount delay={160} className="gap-2">
          <Text variant="large" accessibilityRole="header">
            Limits
          </Text>
          <Card variant="elevated" className="rounded-2xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="gap-1 p-2">
              <ControlRow
                icon="credit-card"
                tileBg="bg-primary/15"
                tint="primary"
                title="Monthly spending"
                subtitle={`${currency}${spentThisMonth.toLocaleString("en-US", { minimumFractionDigits: 2 })} of ${currency}${monthlyLimit.toLocaleString("en-US")} used`}
                onPress={() => onLimitPress?.("monthly")}
              />
              <View className="px-3 pb-2">
                <Progress
                  value={limitPct}
                  accessibilityLabel={`${Math.round(limitPct)}% of monthly limit used`}
                />
              </View>
              <View className="px-3">
                <Separator />
              </View>
              <ControlRow
                icon="globe"
                tileBg="bg-chart-3/15"
                tint="chart3"
                title="Online payments"
                subtitle="Enabled"
                onPress={() => onLimitPress?.("online")}
              />
              <View className="px-3">
                <Separator />
              </View>
              <ControlRow
                icon="map-pin"
                tileBg="bg-chart-5/15"
                tint="chart5"
                title="ATM withdrawals"
                subtitle={`${currency}${atmDailyLimit.toLocaleString("en-US")} per day`}
                onPress={() => onLimitPress?.("atm")}
              />
            </Card.Content>
          </Card>
        </Mount>

        {/* Recent activity on this card. */}
        <Mount delay={240} className="gap-2">
          <Text variant="large" accessibilityRole="header">
            Recent on this card
          </Text>
          <Card variant="elevated" className="rounded-2xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="p-2">
              {transactions.map((tx, i) => (
                <React.Fragment key={tx.id}>
                  {i > 0 ? (
                    <View className="px-3">
                      <Separator />
                    </View>
                  ) : null}
                  <CardTxRow
                    tx={tx}
                    currency={currency}
                    onPress={onTransactionPress}
                  />
                </React.Fragment>
              ))}
            </Card.Content>
          </Card>
        </Mount>

        {/* Lost card — the escape hatch every card screen owes you. */}
        <Mount delay={200}>
          <Pressable
            onPress={() => haptics.light()}
            accessibilityRole="button"
            className="items-center py-3"
          >
            <Text className="text-sm font-medium text-destructive">
              Report lost or stolen
            </Text>
          </Pressable>
        </Mount>
      </ScrollView>
    </SafeAreaView>
  );
}
CardDetailsScreen.displayName = "CardDetailsScreen";
```

Screen: https://lumioui.dev/screens/finance-card-details
Pixel 10 · Android
9:41
Live preview — the real screen via Expo Web · open full ↗