# Price position

Where our prices sit against one competitor: 12% above, 4% below, in line. As a chip for a table cell, or a badge that opens the index and the matched-line evidence on hover or focus.

Docs: https://ui.twelfth.ai/price-position · Category: Pricing · Updated: 2026-10-30

## Install

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

```tsx
import { PricePositionBadge, PricePositionChip } from "@/components/ui/price-position"
```

## Example

```tsx
<PricePositionBadge
  competitor="JB Hi-Fi"
  positionPct={12.4}
  evidence={{ matched: 1284, above: 806, below: 402 }}
  period="8-week comparison"
  channel="Direct retail"
  action={<Link href="/matched">View matched items</Link>}
/>
```

## Badge in a row

Sweep across them: one card open at a time, never stacked.

```tsx
{competitors.map((c) => (
  <PricePositionBadge
    key={c.id}
    competitor={c.name}
    positionPct={c.positionPct}
    evidence={{ matched: c.matched, above: c.above, below: c.below }}
    period="8-week comparison"
  />
))}
```

## Chip

No card: for a dense table column or an inline mention.

```tsx
<PricePositionChip positionPct={12.4} />
<PricePositionChip positionPct={-4.2} />
<PricePositionChip positionPct={0.3} />
<PricePositionChip positionPct={null} />
```

## PricePositionBadge props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `competitor` (required) | `string` |  | Who the comparison is against; named in the card and the label. |
| `positionPct` (required) | `number \| null` |  | Median gap across comparable lines, ours vs theirs, in percent. null when too few lines matched. |
| `evidence` (required) | `{ matched, above, below }` |  | How many lines the position rests on and which way they split. |
| `period` | `string` |  | e.g. "8-week comparison". |
| `channel` | `string` |  | e.g. "Direct retail" or "Marketplace sellers". |
| `action` | `ReactNode` |  | A link or button under the evidence. |
| `className` | `string` |  | Extra classes on the chip. |

## PricePositionChip props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `positionPct` (required) | `number \| null` |  | As above. |
| `className` | `string` |  | Extra classes. |

## Notes

- Opening one card closes any other (one-open), so a row of badges never stacks cards.
- The arrow carries the direction for readers who cannot separate the two tones.
- Reads the favourable and exposed colour tokens installed by market-side.

---

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
