Eidetic

Credit Usage Card

Data Display
Block

A comprehensive card for displaying credit/usage metrics with progress visualization and history.

Preview

Full-featured credit usage card

Credits Used

56.4%

Auto-switch to cheaper model at limit

56.4M / 100M Credits

43.6M Credits Left

Usage History

DateModelCreditsCost
Jan 5, 09:26 PMClaude 4.5 Sonnet Thinking641.5K$0.54
Jan 5, 09:21 PMClaude 4.5 Sonnet Thinking334.1K$0.27
Jan 5, 09:18 PMGPT 5.1 Codex Max194.4K$0.11
Jan 5, 09:16 PMClaude 4.5 Sonnet Thinking277.1K$0.21
Credit billing is via Stripe

Usage States

Various credit usage levels

Credits Used

25.0%

Low usage

25M / 100M Credits

75.0M Credits Left

Usage History

DateModelCreditsCost
Jan 5, 09:26 PMClaude 4.5 Sonnet Thinking641.5K$0.54
Jan 5, 09:21 PMClaude 4.5 Sonnet Thinking334.1K$0.27
Credit billing is via Stripe

Credits Used

85.0%

High usage

85M / 100M Credits

15.0M Credits Left

Usage History

DateModelCreditsCost
Jan 5, 09:26 PMClaude 4.5 Sonnet Thinking641.5K$0.54
Jan 5, 09:21 PMClaude 4.5 Sonnet Thinking334.1K$0.27
Credit billing is via Stripe

Minimal

Without usage history

Credits Used

42.0%

Auto-switch to cheaper model at limit

42M / 100M Credits

58.0M Credits Left

Usage History

No usage history available
Credit billing is via Stripe

Custom Units

Different credit unit labels

Credits Used

72.0%

Auto-switch to cheaper model at limit

7.2GB / 10GB Credits

2.8GB Credits Left

Usage History

No usage history available
Storage billing is monthly

Graph Variant

Area chart visualization instead of table

Credits Used

56.4%

Auto-switch to cheaper model at limit

56.4M / 100M Credits

43.6M Credits Left

Usage History

8002K4KDec 26Jan 2Jan 8

Peak

4.1K

Avg / day

2.5K

Trend

+119.4%

Credit billing is via Stripe

Props

Component API reference

PropTypeDefaultDescription
variant'default' | 'graph''default'Display variant: 'default' shows table, 'graph' shows area chart
creditsUsednumber56.4Current credits used
totalCreditsnumber100Total credits available
creditUnitstring'M'Unit label (e.g., "M", "GB")
autoSwitchbooleantrueAuto-switch toggle state
onAutoSwitchChange(checked: boolean) => voidToggle change callback
autoSwitchLabelstring'Auto-switch...'Toggle label text
usageHistoryUsageHistoryItem[][]History items for the default (table) variant
usageChartDataUsageChartDataPoint[][]Data points for the graph variant ({ date, credits })
periodOptions{ value: string; label: string }[]Period dropdown options
selectedPeriodstring'30'Selected period value
onPeriodChange(value: string) => voidPeriod change callback
segmentsnumber50Progress bar segments
footerNotestring'Credit billing...'Footer note text
actionLabelstring'Manage plan'Action button label
onAction() => voidAction button callback
onViewAll() => voidView all button callback
classNamestringAdditional CSS classes

Usage

Import and implementation examples

import { CreditUsageCard } from '@/blocks/data-display/credit-usage-card'
// Basic usage
<CreditUsageCard
creditsUsed={56.4}
totalCredits={100}
usageHistory={[
{ date: 'Jan 5, 09:26 PM', model: 'Claude 4.5', credits: '641.5K', cost: '$0.54' },
{ date: 'Jan 5, 09:21 PM', model: 'Claude 4.5', credits: '334.1K', cost: '$0.27' },
]}
/>
// With state management
const [autoSwitch, setAutoSwitch] = useState(true)
const [period, setPeriod] = useState('30')
<CreditUsageCard
creditsUsed={56.4}
totalCredits={100}
autoSwitch={autoSwitch}
onAutoSwitchChange={setAutoSwitch}
selectedPeriod={period}
onPeriodChange={setPeriod}
usageHistory={usageData}
onViewAll={() => router.push('/usage')}
onAction={() => router.push('/billing')}
/>
// Custom units
<CreditUsageCard
creditsUsed={7.2}
totalCredits={10}
creditUnit="GB"
footerNote="Storage billing is monthly"
actionLabel="Upgrade storage"
/>
// Graph variant with area chart
<CreditUsageCard
variant="graph"
creditsUsed={56.4}
totalCredits={100}
usageChartData={[
{ date: 'Dec 26', credits: 1200 },
{ date: 'Dec 27', credits: 1800 },
{ date: 'Dec 28', credits: 950 },
// ...
]}
selectedPeriod={period}
onPeriodChange={setPeriod}
/>

Built With

4 components

This block uses the following UI components from the design system:

Features

Built-in functionality

  • Segmented progress bar: Visual usage indicator with 50 segments
  • Auto-switch toggle: Built-in switch for model fallback
  • Usage history table: Default variant with date, model, credits, cost columns
  • Graph variant: SVG area chart with hover tooltip, peak/avg/trend stats
  • Period selector: Dropdown for time range filtering
  • Customizable units: Support for any unit label (M, GB, etc.)
  • Action buttons: View all and manage plan actions
  • Footer with branding: Customizable footer note and icon
  • Dark mode: Full dark mode support

Accessibility

Accessibility considerations

ARIA Attributes

Progress bar has role="progressbar"Switch is properly labeledTable uses semantic structure

Keyboard Navigation

KeyAction
TabNavigate through interactive elements
Space/EnterToggle switch, activate buttons
Arrow keysNavigate select dropdown

Notes

  • History table is scrollable for many items
  • Color is not the only indicator of usage level
  • All interactive elements are keyboard accessible