Data Display Atoms
Available via @stackmates/ui-interactive/atoms
PriceDisplay
Formatted currency display with preset support (USD, EUR, GBP, AUD, JPY) and compact notation.
PriceDisplayProps
| Prop | Type | Default | Description |
|---|---|---|---|
| amount* | number | bigint | — | Amount in smallest currency unit (cents for USD/EUR) |
| currency | string | CurrencyConfig | 'USD' | Currency preset code or custom config |
| showSymbol | boolean | true | Show currency symbol |
| showCode | boolean | false | Show currency code after amount |
| compact | boolean | false | Use compact notation for large numbers |
| size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'md' | Text size variant |
| variant | 'default' | 'muted' | 'success' | 'danger' | 'primary' | 'default' | Color variant (negative amounts auto-switch to danger) |
Installation
import { PriceDisplay } from '@stackmates/ui-interactive/atoms';Usage
Basic (cents)
<PriceDisplay amount={12500} /> {/* $125.00 */}Compact large values
<PriceDisplay amount={1234567} compact size="xl" />Accessibility
- Renders as <span> with tabular-nums for consistent digit width
- Currency symbol is visible text, not icon-only
- Negative values indicated by parentheses and red color (not color alone)
AIConfidenceScore
AI confidence badge with HITL color coding: green (>=80%), yellow (60-79%), red (<60%).
HITL color coding
AIConfidenceScoreProps
| Prop | Type | Default | Description |
|---|---|---|---|
| score* | number | — | Confidence score (0-100 or 0-1, auto-normalized) |
| size | 'sm' | 'md' | 'lg' | 'md' | Size variant |
| showIcon | boolean | true | Show the AI sparkle icon |
| showLabel | boolean | true | Show the confidence level label |
| label | string | — | Custom label (overrides default level label) |
Installation
import { AIConfidenceScore } from '@stackmates/ui-interactive/atoms';Usage
Percentage input
<AIConfidenceScore score={92} />Decimal input (auto-normalized)
<AIConfidenceScore score={0.85} size="sm" />Accessibility
- Color + text label convey confidence level (not color alone)
- Title attribute provides full "AI Confidence: N%" tooltip
- Sparkle icon is aria-hidden, decorative only
AISuggestedBadge
Badge labeling AI-generated, suggested, enhanced, or auto-filled content.
AISuggestedBadgeProps
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'generated' | 'suggested' | 'enhanced' | 'auto-filled' | 'generated' | Type of AI suggestion |
| size | 'sm' | 'md' | 'sm' | Size variant |
| label | string | — | Custom label (overrides default) |
Installation
import { AISuggestedBadge } from '@stackmates/ui-interactive/atoms';Usage
Default (generated)
<AISuggestedBadge />Enhanced variant
<AISuggestedBadge variant="enhanced" size="md" />Accessibility
- Icon + text label convey AI origin (not icon alone)
- Each variant uses distinct icon for additional differentiation
- data-variant attribute available for test selectors
AIConfidenceScoreCompact
Compact inline variant showing just score percentage with HITL color indicator. Use for tight layouts like table cells.
Inline usage alongside text
In context
AIConfidenceScoreCompactProps
| Prop | Type | Default | Description |
|---|---|---|---|
| score* | number | — | Confidence score (0-100 or 0-1, auto-normalized) |
| className | string | — | Additional CSS classes |
Installation
import { AIConfidenceScoreCompact } from '@stackmates/ui-interactive/atoms';Usage
Inline with content
<span>Suggested price: $12,500 <AIConfidenceScoreCompact score={87} /></span>In a table cell
<AIConfidenceScoreCompact score={0.92} />Accessibility
- Title attribute provides "AI Confidence: N%" tooltip on hover
- Sparkle icon is aria-hidden as decorative, score text conveys information
- Color-coded text matches HITL thresholds (green >= 80%, yellow 60-79%, red < 60%)
AISuggestedIcon
Icon-only variant of AISuggestedBadge for inline use where space is limited. Shows tooltip on hover.
Inline with text
AISuggestedIconProps
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'generated' | 'suggested' | 'enhanced' | 'auto-filled' | 'generated' | Type of AI suggestion (determines icon and tooltip) |
| className | string | — | Additional CSS classes |
Installation
import { AISuggestedIcon } from '@stackmates/ui-interactive/atoms';Usage
Inline indicator
<span>Deal summary <AISuggestedIcon variant="generated" /></span>Different variants
<AISuggestedIcon variant="suggested" />
<AISuggestedIcon variant="enhanced" />Accessibility
- Title attribute provides variant label (e.g. "AI Generated") as tooltip
- Icon-only display relies on title for screen reader context
- Each variant uses a distinct Lucide icon for visual differentiation beyond color
ProgressStateful
State-aware progress bar with idle/active/complete/error states and customizable labels.
ProgressStatefulProps
| Prop | Type | Default | Description |
|---|---|---|---|
| state* | 'idle' | 'active' | 'complete' | 'error' | — | Current progress state (idle renders nothing) |
| progress* | number | — | Progress percentage (0-100) |
| labels | Partial<Record<'active' | 'complete' | 'error', string>> | — | Custom labels per state |
Installation
import { ProgressStateful } from '@stackmates/ui-interactive/atoms';Usage
Active state
<ProgressStateful state="active" progress={45} />Error with custom label
<ProgressStateful state="error" progress={72} labels={{ error: 'Upload failed' }} />Accessibility
- State label is visible text, not color alone
- Progress percentage displayed as numeric text
- Idle state renders nothing (no empty container)
StarRating
Interactive 1-5 star rating with hover scale feedback and disabled read-only mode.
StarRatingProps
| Prop | Type | Default | Description |
|---|---|---|---|
| value* | number | — | Current rating value (1-max) |
| onChange | (value: number) => void | — | Change handler for interactive mode |
| disabled | boolean | false | Disable interaction |
| max | number | 5 | Maximum number of stars |
| size | 'sm' | 'md' | 'lg' | 'md' | Star size variant |
Installation
import { StarRating } from '@stackmates/ui-interactive/atoms';Usage
Interactive
const [rating, setRating] = useState(3);
<StarRating value={rating} onChange={setRating} />Read-only
<StarRating value={4} disabled />Accessibility
- Each star is a <button> with aria-label "Rate N of M stars"
- Disabled state uses cursor-not-allowed and muted styling
- Numeric rating shown as text "(N/M)" alongside stars
ErrorMessage
Error text display with role="alert" for form validation feedback.
This field is required.
Email address is not valid.
ErrorMessageProps
| Prop | Type | Default | Description |
|---|---|---|---|
| message | string | — | Error text to display (renders nothing when empty) |
| id | string | — | HTML id for aria-describedby linking |
Installation
import { ErrorMessage } from '@stackmates/ui-interactive/atoms';Usage
Basic
<ErrorMessage message="This field is required." />With aria linking
<ErrorMessage message="Invalid email" id="email-error" />
<input aria-describedby="email-error" />Accessibility
- Uses role="alert" for screen reader announcement
- Supports id prop for aria-describedby linking to form inputs
- Renders nothing when message is empty (no empty container)
Badge
General-purpose label/tag with 7 semantic variants. CVA-styled with Radix Slot support for polymorphism.
BadgeProps
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'danger' | 'default' | Visual variant determining color scheme |
| asChild | boolean | false | Merge props onto child element via Radix Slot (e.g. render an <a> styled as Badge) |
| className | string | — | Additional CSS classes |
Installation
import { Badge } from '@stackmates/ui-interactive/atoms';Usage
Default variant
<Badge>New</Badge>Semantic variants
<Badge variant="success">Active</Badge>
<Badge variant="warning">Pending</Badge>
<Badge variant="destructive">Overdue</Badge>As link (Slot pattern)
<Badge asChild variant="outline">
<a href="/deals">View Deals</a>
</Badge>Accessibility
- Renders as <span> by default with proper inline semantics
- asChild merges props onto child element via Radix Slot
- Focus-visible ring for keyboard navigation when used as link
- aria-invalid triggers destructive ring styling for error states
TrendIndicator
Displays metric trend direction with percentage change or custom label. Auto-calculates direction from sign of change value.
Auto-direction from change value
Custom label with explicit direction
TrendIndicatorProps
| Prop | Type | Default | Description |
|---|---|---|---|
| change | number | — | Percentage change value (e.g. 5.2 for +5.2%). Direction auto-calculated from sign. |
| direction | 'up' | 'down' | 'stable' | — | Trend direction. Auto-calculated from change, or required when using label. |
| label | string | — | Custom label text instead of percentage. When used, direction is required. |
| showPercent | boolean | true | Show percentage sign after numeric change |
| size | 'sm' | 'md' | 'md' | Text and icon size variant |
Installation
import { TrendIndicator } from '@stackmates/ui-interactive/atoms';Usage
Numeric change (auto-direction)
<TrendIndicator change={5.2} /> {/* Green up arrow +5.2% */}
<TrendIndicator change={-3.1} /> {/* Red down arrow -3.1% */}Custom label
<TrendIndicator direction="up" label="Growing fast" />Accessibility
- Icon + text convey direction (not color alone)
- data-direction attribute for test selectors
- data-testid="trend-indicator" for automated testing
- Icons are aria-hidden, text content provides meaning
CostDisplay
Formatted USD cost display with optional input/output token counts. Designed for AI operation cost visibility.
CostDisplayProps
| Prop | Type | Default | Description |
|---|---|---|---|
| costUsd* | number | — | Cost amount in USD (displayed to 4 decimal places) |
| tokens | { input: number; output: number } | — | Optional token counts shown alongside cost |
| className | string | — | Additional CSS classes |
Installation
import { CostDisplay } from '@stackmates/ui-interactive/atoms';Usage
Cost only
<CostDisplay costUsd={0.0042} />With token breakdown
<CostDisplay costUsd={0.0087} tokens={{ input: 1250, output: 340 }} />Accessibility
- Uses tabular-nums for consistent digit width alignment
- Cost value displayed as text, not color-coded
- Token counts provide additional context alongside cost