# Price trend

Weekly price position against the market as a small line with a dashed parity line. Hover, or focus and use the arrow keys, to read any week's position, index and change.

Docs: https://ui.twelfth.ai/price-trend · Category: Pricing · Updated: 2026-11-02

## Install

```bash
npx shadcn@latest add https://ui.twelfth.ai/r/price-trend.json
```

```tsx
import { PriceTrend } from "@/components/ui/price-trend"
```

## Example

```tsx
<PriceTrend
  points={weeklyPosition} // [{ week: "2026-07-27", positionPct: 4 }, …]
  label="vs JB Hi-Fi"
  against="JB Hi-Fi"
  width={120}
  height={32}
  smooth={true}
/>
```

## Drifting above

```tsx
<PriceTrend points={points} label="vs market" />
<PriceTrend points={points} label="vs market" width={48} height={16} />
```

## Crossing parity

```tsx
<PriceTrend points={points} label="vs market" />
<PriceTrend points={points} label="vs market" width={48} height={16} />
```

## Gaps in the data

```tsx
<PriceTrend points={points} label="vs market" />
<PriceTrend points={points} label="vs market" width={48} height={16} />
```

## PriceTrend props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `points` (required) | `{ week: string; positionPct: number \| null }[]` |  | Weekly position, oldest first. A null week breaks the line. |
| `label` (required) | `string` |  | What the line is, for the card and screen readers. |
| `against` | `string` | `"the market"` | Who the comparison is against, in the explainer. |
| `width` | `number` | `96` | Pixels. |
| `height` | `number` | `28` | Pixels. |
| `inverse` | `boolean` | `false` | On a dark tile: the line takes the tile's text colour. |
| `smooth` | `boolean` | `true` | Gently rounds joins without overshooting the observed values. |

## Notes

- The y axis is symmetric around zero, so parity is always the middle and above is always up.
- Opens instantly and shares one-open with the price badges.

---

twelfth UI: Open-source (MIT) shadcn components for category managers and retail buying teams, by twelfth (https://twelfth.ai). React and TypeScript on shadcn's Base UI styles and Tailwind CSS v4. Components take plain props and fetch no data. Every block: https://ui.twelfth.ai/llms.txt
