---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Chart line

A line or area chart of up to five levels over time, read on hover, press or keyboard, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `ChartLine`.

## Try it

Point at the plot (or Tab and use the arrows) to move the crosshair; switch line or area, the look (two lines, a day missing, the gap over its body, five series), the dashed comparison, the readout, the labels and markers, the legend beside, loading; hide a series from its legend.

The interviews are ours.

## When to use

- A line or area chart of up to five levels over time, read on hover, press or keyboard.
- Also called: line graph.

## When not to use

- A flow in and out is ChartBar.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Chart line on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-chart-line.json --yes
```

```text
Add the Goop Chart line to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { ChartLine } from '@/components/ui/goop/chart-line';

<ChartLine
  variant="area"
  title="Interviews by day"
  description="This week"
  summary="Interviews recorded each day: Thursday had the most, Friday the fewest."
  config={{ recorded: { label: 'This week' }, before: { label: 'Last week', dashed: true } }}
  categoryKey="day"
  unit="interviews"
  readout={{ label: 'This week', value: 'total', compare: 'last week' }}
  data={[
    { day: 'Mon', recorded: 6, before: 4 },
    { day: 'Tue', recorded: 9, before: 7 },
    { day: 'Wed', recorded: 7, before: 8 },
    { day: 'Thu', recorded: 11, before: 6 },
    { day: 'Fri', recorded: 3, before: 6 },
  ]}
/>
```

- Fits: overview (its recipe).
- motion: add no class for these.

## API reference

### Options

- `variant: default | area = default`
- `config: NoInfer<ChartConfig<ChartKey<Data>>>` — The series, in order, each keyed by a field of the rows: its `label`, and `dashed` if wanted.
- `data: Data` — The rows, in the category axis's order: of the caller's own type (an interface too) or `ChartRow`.
- `categoryKey: NoInfer<ChartKey<Data>>` — The field of each row that holds its category.
- `Defaults: encode = true; otherLabel = 'Other'`

- Takes every prop of ChartContainer but plot, children, scrub, toggles and stack (its page: chart.md)

## Keyboard

- Tab: focus the plot
- ArrowLeft: move the active point one category
- ArrowRight: move the active point one category
- ArrowUp: move the active point to the next category
- ArrowDown: move the active point to the previous category
- PageUp: move the active point seven categories on
- PageDown: move the active point seven categories back
- Home: move the active point to the first category
- End: move the active point to the last category
- Escape: put the active point to rest

## Accessibility

- The part itself answers the keys above.

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Chart bar](/themes/trail/components/chart-bar): A bar chart of amounts by category or period, side by side or stacked.
- [Chart donut](/themes/trail/components/chart-donut): A donut chart that shows how one whole splits into parts, each slice read on hover, on a press or from the keyboard.
- [Sparkline](/themes/trail/components/sparkline): One line of a series' shape, as wide as its caller and as tall as the text line it sits in.
- [Bar list](/themes/trail/components/bar-list): A ranked list of rows, each a label, a bar for its share and its number, sorted by that number.
