# RugStrip (/docs/charts/rug-strip)

RugStrip answers "where do the raw observations actually sit?". Every tick is one real observation — no binning, no
jitter, no thinning. Stacked duplicates darken (tiered opacity), and `markValue` tells the chart's strongest single
story: one raw value against the field.

```tsx
import { RugStrip } from "@microcharts/react/rug-strip";

<RugStrip data={salaries} markValue={78} title="Pay band" />
```

## Install

```tsx
import { RugStrip } from "@microcharts/react/rug-strip";

<RugStrip data={salaries} markValue={yourOffer} title="Pay band" />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.


## When to use it

- **Good for** — "you are here" in a pay band, raw spread beside a stat, margin composition under a Sparkline.
- **Avoid for** — more than ~400 observations (a rug promises raw marks and never downsamples; use HistogramStrip) or
  trends over time (Sparkline).


## Variants

```tsx
<RugStrip data={field} markValue={62} />
```

```tsx
// coincident observations accumulate ink — that IS the density read
<RugStrip data={[50, 50, 50, 50, 62, 71]} />
```

```tsx
<RugStrip data={field} orientation="vertical" />
```

## Edge cases

```tsx
<RugStrip data={[]} title="No observations" />
```

Empty data draws a quiet centered axis line — not a blank hole — so the strip still reads as "a rug with nothing on it"
rather than a layout gap.

```tsx
<RugStrip data={[52]} title="One observation" />
```

A single value (or an all-equal field) has a zero-span domain; the tick renders at the strip's midpoint instead of
dividing by zero.

```tsx
<RugStrip data={[42, 48, 55, 61, 71]} markValue={120} />
```

A `markValue` outside the observed domain clamps to the nearest edge — it never escapes the box or silently rescales the
field around it.


## Why this default

Ticks sit at 35% opacity — singles stay visible while stacks read as density. Because a browser paints one path's stroke
as a single operation, coincident ticks are bucketed into opacity tiers (35% / 60% / 85%) rather than relying on overlap
compositing that never happens. Regular ticks are inset one unit so the full-height accent highlight reads "taller"
without escaping the box.

## Accessibility

The accessible name is the distribution — **"8 values from 42 to 75, median 59.5."** The interactive entry walks
observations in sorted order and announces each with its rank: **"48 — 2nd of 17."**

The interactive entry follows the shared [interaction contract](/docs/accessibility#one-interaction-contract):
arrow keys rove between units on both axes, `Home` and `End` jump to the ends, and a click, tap, `Enter` or
`Space` selects a unit — pinning its readout so it survives blur, until you select it again or press `Escape`.
On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `number[]` | Raw observations — position = value. |
| `markValue` | `number` | One value emphasized against the field. |
| `orientation` | `"horizontal" \| "vertical"` | Vertical rugs sit beside distributions. |
| `domain` | `[number, number]` | Fix the scale across rows (rugs mislead worst under per-row autoscale). |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
