Kinetik UI

Expense Card

.md

A spending card with a period menu and horizontal bars on a dashed grid that grow in one by one.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add expense-card

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/expense-card.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/expense-card.tsx
    View source files

Usage

import { ExpenseCard } from '@/components/kinetik/expense-card';

<ExpenseCard
  icon={<ChartIcon />}
  rows={[
    { label: 'Housing', value: 6200 },
    { label: 'Utilities', value: 1400 },
    { label: 'Food', value: 2150 },
  ]}
  periods={['Weekly', 'Monthly', 'Yearly']}
  period={period}
  onPeriodChange={setPeriod}
/>;

When to use

  • A handful of categories compared on one scale, in a dashboard or finance overview.

When not to use

  • Trends over time: use a line or bar chart with a time axis.
  • More than six categories: the card gets long; show the top few and link to the rest.

Notes

  • The scale tops out at the largest value rounded up to a tidy number (niceMax), or at max.
  • Bars regrow from zero when the period changes. A category of 0 shows a small placeholder square.
  • Values format as 2K, 10K by default; pass formatValue for currencies.

Props

ExpenseCardProps

PropTypeDefaultDescription
rowsrequiredreadonly ExpenseRow[]—The rows for the current period. Values of 0 show an empty marker.
titlestring'Major Expenses'
iconReactNode—Icon before the title.
periodsreadonly P[]—Periods offered in the menu, e.g. ["Weekly", "Monthly", "Yearly"].
periodP—
onPeriodChange(period: P) => void—
maxnumber—Top of the scale. Defaults to the largest value rounded up to a tidy number.
formatValue(value: number) => stringcompactFormats axis labels and values. Defaults to 2K, 10K style.
colorstring—Bar colour. Defaults to the theme azure.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Each bar grows once per change with a UI-thread spring; the grid and labels are static views.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.00× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 154 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
Bars appear at their length and the menu opens without zooming.
Screen readers
The chart reads as one summary ("Housing 6.2K, Utilities 1.4K, Food 2.1K"); the period button reports whether its menu is open; options are menu items.
Touch target
The period button and menu options are at least 44 pt.

Source files

components/kinetik/expense-card.tsx is in the Code tab of the preview above.