# Stat Tile (Andromeda Legacy)

Stat Tile is a component of the free, MIT-licensed Andromeda Legacy design system from AI Canvas (https://aicanvas.me). Index of every system, component and install setup: https://aicanvas.me/llms.txt

Stat readout built on Card. Big numeric value, optional unit, optional ▲/▼ delta whose glyph carries the direction and whose color carries the judgment: set polarity to lower-is-better and a falling response time reads as the improvement it is, or none for a reading with no good/bad sense. Scroll-aware count-up on first view, a live mode that snaps to new values, a per-digit odometer roll (liveRoll), and a top-right code identifier prop.

- Design system: [Andromeda Legacy](https://aicanvas.me/design-systems/andromeda.md)
- License: MIT
- Install slug: `andromeda-stat-tile`
- Page: https://aicanvas.me/design-systems/andromeda/stat-tile

## Install

```bash
npx shadcn@latest add @aicanvas/andromeda-stat-tile
```

Needs a free AI Canvas account; signed out, the command writes a placeholder (an `AccountRequired` notice) instead.

Every Andromeda Legacy component at once: `npx shadcn@latest add @aicanvas/andromeda`.

Token setup: the Install section of https://aicanvas.me/llms.txt.

## Use it

It installs to `components/aicanvas/andromeda/components/StatTile.tsx` (under `src/` if your project has one). With the usual `@/` alias:

```tsx
import { StatTile } from '@/components/aicanvas/andromeda/components/StatTile'
```

## Example

```tsx
import { StatTile } from '@/components/aicanvas/andromeda/components/StatTile'

<StatTile label="Open invoices" value={24} delta={8.3} deltaLabel="this month" code="INV-01" />
```

## Variants

- `polarity`: higher-is-better, lower-is-better or none (default 'higher-is-better')

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` |  | Metric name shown in the top-left mono caption. |
| `value` | `string\|number` |  | Primary figure rendered as the large number, counted up from zero on reveal. |
| `unit?` | `string` |  | Short unit rendered beside the value. |
| `delta?` | `number` |  | Signed change. The ▲/▼ glyph always states the direction of the move; `polarity` decides whether that move is coloured as good (accent) or bad (fault). Exactly 0 is neutral: no glyph, muted. |
| `polarity?` | `'higher-is-better'\|'lower-is-better'\|'none'` | `'higher-is-better'` | Which direction is the good one for this metric. `'lower-is-better'` for response time, latency, error rate, incident count — a drop there is an improvement and must not render red. `'none'` for readings with no good/bad sense at all (demand, headcount, temperature): the arrow still states the move, the delta stays muted. |
| `deltaLabel?` | `string` |  | Caption shown beside the delta in the trend row. |
| `code?` | `string` |  | Optional small mono identifier in the top-right. |
| `live?` | `boolean` | `false` | When true, the count-up animation runs only on first mount; subsequent value changes snap (no re-animation). Use for telemetry rows whose values update on a recurring interval. Without this, each refresh runs a fresh 1.8s count-up from zero, which is unreadable. |
| `liveRoll?` | `boolean` | `false` | When true, the value is rendered as a row of fixed-width digit slots; on update, only the slots whose character changed "roll" (previous translates up + fades, new enters from below). Use for high-frequency telemetry where the eye should track which digits moved (price ticks, latency counters, throughput rates). Overrides `live`. Initial render fades in without rolling. |
| `className?` | `string` |  | Extra classes merged onto the root Card. |
| `style?` | `React.CSSProperties` |  | Inline styles merged onto the root Card. |

## More Andromeda Legacy components

- [Tag](https://aicanvas.me/design-systems/andromeda/tag.md)
- [Textarea](https://aicanvas.me/design-systems/andromeda/textarea.md)
- [Toggle](https://aicanvas.me/design-systems/andromeda/toggle.md)
- [Table](https://aicanvas.me/design-systems/andromeda/table.md)
- [Tooltip](https://aicanvas.me/design-systems/andromeda/tooltip.md)
