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

Budgets Screen

Category budgets with spend progress

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add finance-budgets
import { BudgetsScreen } from "@/screens/finance/budgets";
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
finance/budgets.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, type IconName, List, Progress, ProgressRing, Text } from "@lumioui/ui";
import { type ColorTokens, useHaptic } from "@lumioui/core";
import { LumioMark, Mount, Press, SEPARATOR_INSET } from "../shared";

export interface Budget {
  id: string;
  category: string;
  icon: IconName;
  /** "spent of limit", e.g. { spent: 640, limit: 800 }. */
  spent: number;
  limit: number;
  /** Soft-tint tile background class. */
  tileBg?: string;
  /** Icon tint token — pairs with `tileBg`. */
  tint?: keyof ColorTokens;
}

export interface BudgetsScreenProps {
  month?: string;
  budgets?: Budget[];
  onBudgetPress?: (id: string) => void;
  onAddBudget?: () => void;
  onBack?: () => void;
}

const DEFAULT_BUDGETS: Budget[] = [
  { id: "b1", category: "Dining", icon: "utensils", spent: 342, limit: 400, tileBg: "bg-warning/15", tint: "warning" },
  { id: "b2", category: "Groceries", icon: "carrot", spent: 514, limit: 600, tileBg: "bg-success/15", tint: "success" },
  { id: "b3", category: "Transport", icon: "car", spent: 188, limit: 250, tileBg: "bg-chart-2/15", tint: "chart2" },
  { id: "b4", category: "Shopping", icon: "shopping-cart", spent: 762, limit: 700, tileBg: "bg-chart-3/15", tint: "chart3" },
];

/** Budgets — category rows with spend progress; overage turns red. */
export function BudgetsScreen({
  month = "September",
  budgets = DEFAULT_BUDGETS,
  onBudgetPress,
  onAddBudget,
  onBack,
}: BudgetsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <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={() => haptics.light()}
              accessibilityRole="button"
              accessibilityLabel="New budget"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="plus" 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">
              Budgets
            </Text>
          </View>
        </View>
      </View>

      {/* Ring hero — total spend share is the signature numeral; the ring is
          the object the screen is about, not decoration. */}
      <Mount className="mx-4 mb-4 flex-row items-center gap-5 rounded-2xl bg-white p-5 dark:bg-[#1A1A20]" style={{ marginTop: insets.top + 60 }}>
        <ProgressRing value={93} size={96} strokeWidth={9} color="success">
          <View className="items-center">
            <Text className="text-xl font-bold tabular-nums tracking-tight">93%</Text>
            <Text variant="muted" className="text-[10px]">spent</Text>
          </View>
        </ProgressRing>
        <View className="flex-1 gap-0.5">
          <Text variant="small" className="text-muted-foreground">{month}</Text>
          <Text className="text-3xl font-bold tracking-tight">$1,806</Text>
          <Text variant="muted" className="text-xs">of $1,950 · 11 days left</Text>
          <View className="mt-1.5 flex-row items-center gap-1.5">
            <View className="h-1.5 w-1.5 rounded-full bg-destructive" />
            <Text variant="small" className="text-xs text-destructive">Shopping is over budget</Text>
          </View>
          {/* Daily allowance — budgets become actionable as a per-day number. */}
          <Text variant="muted" className="mt-1 text-xs">
            ~$13/day keeps you inside September
          </Text>
        </View>
      </Mount>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
      >
        <List inset>
          <List.Section>
            {budgets.map((b, ii) => {
              const pct = Math.min(100, Math.round((b.spent / b.limit) * 100));
              const over = b.spent > b.limit;
              return (
                <React.Fragment key={b.id}>
                  {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                  <List.Item
                    title={b.category}
                    subtitle={`$${b.spent} of $${b.limit}`}
                    titleClassName={over ? "text-destructive" : undefined}
                    leading={
                      <View
                        className={`h-8 w-8 items-center justify-center rounded-2xl ${
                          over ? "bg-destructive/15" : (b.tileBg ?? "bg-muted")
                        }`}
                      >
                        <Icon
                          name={b.icon}
                          size="sm"
                          color={over ? "destructive" : (b.tint ?? "foreground")}
                        />
                      </View>
                    }
                    trailing={
                      <Text
                        variant="small"
                        className={over ? "font-medium text-destructive" : "text-muted-foreground"}
                      >
                        {over ? `$${b.spent - b.limit} over` : `$${b.limit - b.spent} left`}
                      </Text>
                    }
                    haptic="light"
                    onPress={() => onBudgetPress?.(b.id)}
                    className="py-3"
                  />
                  {/* Progress bar under the row content — spending is the
                      thing the budget is *for*, so the bar lives here, not
                      as a decorative ring. */}
                  <View className="px-4 pb-3 pl-[60px]">
                    <Progress
                      value={pct}
                      className={over ? "bg-destructive/20" : undefined}
                      indicatorClassName={over ? "bg-destructive" : undefined}
                    />
                  </View>
                </React.Fragment>
              );
            })}
          </List.Section>
        </List>

        <Mount delay={60} className="mt-4 px-4">
          <Button
            tone="inverse"
            haptic="light"
            onPress={() => onAddBudget?.()}
            accessibilityLabel="Add budget"
            className="w-full bg-[#1B1B26]"
          >
            <Icon name="plus" size="sm" color="#FFFFFF" />
            <Text className="ml-1.5">New budget</Text>
          </Button>
          <Text variant="muted" className="mt-4 text-center text-xs">
            Budgets reset on the 1st of each month
          </Text>
        </Mount>
      </ScrollView>
    </SafeAreaView>
  );
}
BudgetsScreen.displayName = "BudgetsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Budgets Screen" screen in React Native using LumioUI.

Goal: Category budgets with spend progress 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-budgets
```

Or pull just the components: `npx lumioui add button icon list progress progress-ring 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>` ×1

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

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

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

### `progress-ring` — Circular progress ring with animated stroke arc, center slot and indeterminate spin.
- `<ProgressRing>` ×1

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

## 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/budgets.tsx` exporting BudgetsScreen. 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, type IconName, List, Progress, ProgressRing, Text } from "@lumioui/ui";
import { type ColorTokens, useHaptic } from "@lumioui/core";
import { LumioMark, Mount, Press, SEPARATOR_INSET } from "../shared";

export interface Budget {
  id: string;
  category: string;
  icon: IconName;
  /** "spent of limit", e.g. { spent: 640, limit: 800 }. */
  spent: number;
  limit: number;
  /** Soft-tint tile background class. */
  tileBg?: string;
  /** Icon tint token — pairs with `tileBg`. */
  tint?: keyof ColorTokens;
}

export interface BudgetsScreenProps {
  month?: string;
  budgets?: Budget[];
  onBudgetPress?: (id: string) => void;
  onAddBudget?: () => void;
  onBack?: () => void;
}

const DEFAULT_BUDGETS: Budget[] = [
  { id: "b1", category: "Dining", icon: "utensils", spent: 342, limit: 400, tileBg: "bg-warning/15", tint: "warning" },
  { id: "b2", category: "Groceries", icon: "carrot", spent: 514, limit: 600, tileBg: "bg-success/15", tint: "success" },
  { id: "b3", category: "Transport", icon: "car", spent: 188, limit: 250, tileBg: "bg-chart-2/15", tint: "chart2" },
  { id: "b4", category: "Shopping", icon: "shopping-cart", spent: 762, limit: 700, tileBg: "bg-chart-3/15", tint: "chart3" },
];

/** Budgets — category rows with spend progress; overage turns red. */
export function BudgetsScreen({
  month = "September",
  budgets = DEFAULT_BUDGETS,
  onBudgetPress,
  onAddBudget,
  onBack,
}: BudgetsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <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={() => haptics.light()}
              accessibilityRole="button"
              accessibilityLabel="New budget"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="plus" 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">
              Budgets
            </Text>
          </View>
        </View>
      </View>

      {/* Ring hero — total spend share is the signature numeral; the ring is
          the object the screen is about, not decoration. */}
      <Mount className="mx-4 mb-4 flex-row items-center gap-5 rounded-2xl bg-white p-5 dark:bg-[#1A1A20]" style={{ marginTop: insets.top + 60 }}>
        <ProgressRing value={93} size={96} strokeWidth={9} color="success">
          <View className="items-center">
            <Text className="text-xl font-bold tabular-nums tracking-tight">93%</Text>
            <Text variant="muted" className="text-[10px]">spent</Text>
          </View>
        </ProgressRing>
        <View className="flex-1 gap-0.5">
          <Text variant="small" className="text-muted-foreground">{month}</Text>
          <Text className="text-3xl font-bold tracking-tight">$1,806</Text>
          <Text variant="muted" className="text-xs">of $1,950 · 11 days left</Text>
          <View className="mt-1.5 flex-row items-center gap-1.5">
            <View className="h-1.5 w-1.5 rounded-full bg-destructive" />
            <Text variant="small" className="text-xs text-destructive">Shopping is over budget</Text>
          </View>
          {/* Daily allowance — budgets become actionable as a per-day number. */}
          <Text variant="muted" className="mt-1 text-xs">
            ~$13/day keeps you inside September
          </Text>
        </View>
      </Mount>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
      >
        <List inset>
          <List.Section>
            {budgets.map((b, ii) => {
              const pct = Math.min(100, Math.round((b.spent / b.limit) * 100));
              const over = b.spent > b.limit;
              return (
                <React.Fragment key={b.id}>
                  {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                  <List.Item
                    title={b.category}
                    subtitle={`$${b.spent} of $${b.limit}`}
                    titleClassName={over ? "text-destructive" : undefined}
                    leading={
                      <View
                        className={`h-8 w-8 items-center justify-center rounded-2xl ${
                          over ? "bg-destructive/15" : (b.tileBg ?? "bg-muted")
                        }`}
                      >
                        <Icon
                          name={b.icon}
                          size="sm"
                          color={over ? "destructive" : (b.tint ?? "foreground")}
                        />
                      </View>
                    }
                    trailing={
                      <Text
                        variant="small"
                        className={over ? "font-medium text-destructive" : "text-muted-foreground"}
                      >
                        {over ? `$${b.spent - b.limit} over` : `$${b.limit - b.spent} left`}
                      </Text>
                    }
                    haptic="light"
                    onPress={() => onBudgetPress?.(b.id)}
                    className="py-3"
                  />
                  {/* Progress bar under the row content — spending is the
                      thing the budget is *for*, so the bar lives here, not
                      as a decorative ring. */}
                  <View className="px-4 pb-3 pl-[60px]">
                    <Progress
                      value={pct}
                      className={over ? "bg-destructive/20" : undefined}
                      indicatorClassName={over ? "bg-destructive" : undefined}
                    />
                  </View>
                </React.Fragment>
              );
            })}
          </List.Section>
        </List>

        <Mount delay={60} className="mt-4 px-4">
          <Button
            tone="inverse"
            haptic="light"
            onPress={() => onAddBudget?.()}
            accessibilityLabel="Add budget"
            className="w-full bg-[#1B1B26]"
          >
            <Icon name="plus" size="sm" color="#FFFFFF" />
            <Text className="ml-1.5">New budget</Text>
          </Button>
          <Text variant="muted" className="mt-4 text-center text-xs">
            Budgets reset on the 1st of each month
          </Text>
        </Mount>
      </ScrollView>
    </SafeAreaView>
  );
}
BudgetsScreen.displayName = "BudgetsScreen";
```

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