Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-sparkline.json --yes

Sparkline

Pro

One line of a series' shape, as wide as its caller and as tall as the text line it sits in, for React and Tailwind CSS. Part of Goop Pro.

Switch the numbers (rising, falling, flat, with a gap), where it sits (in a sentence or the whole width) and the end dot: the line redraws. With Interactive on, point at the line or focus it and use the arrows: the day is read out below. The numbers are ours; the day read out is only written under it.

When to use

  • One line of a series' shape, as wide as its caller and as tall as the text line it sits in.
  • Also called: mini chart.

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 Sparkline 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.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-sparkline.json --yes
PROMPT
Add the Goop Sparkline to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Sparkline } from '@/components/ui/goop/sparkline';

<>
  <p>
    Notes this month: 42 <Sparkline values={[3, 5, 4, 8, 6, 9, 7]} label="Notes per day, rising this week" />
  </p>
  <Sparkline
    values={[31, 30, 31, 28, 29, 26, 24, 22]}
    label="Weekly retention, falling"
    variant="destructive"
    area
    baseline={31}
    extremes
    interactive
    format={(value) => `${value}%`}
  />
</>
  • Fits: overview (its recipe); overview, list: row.
  • height, width, padding, corner, border, background, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
valuesReadonlyArray<number | null>The series, in time order; a null is a gap.
labelstring | nullYour sentence naming the image; null hides it from assistive technology where nearby text says it.
dot?boolean = trueDraw the theme's dot at the last value.
highlight?number | false = 2How many steps at the end are the latest stretch, in the variant's colour; false colours the whole line.
variant?Extract<StatusVariant, 'default' | 'success' | 'destructive'> = 'default'The latest stretch's colour: the first data colour, or good (success) or bad (destructive).
area?boolean = falseA soft area under the latest stretch, fading down to nothing.
baseline?number
extremes?boolean = falseSmall hollow marks on the lowest and the highest values.
interactive?boolean = falseA slider over the points: the pointer or the keys show a hairline and a dot at a point.
defaultIndex?numberThe point an interactive sparkline holds at first.
format?(value: number, index: number) => stringThe words a value is read out in; the reader's own number format by default.
onPoint?(point: SparklinePoint | null) => voidTold the point shown, null at rest: a tile's figure can follow it.
  • Types: SparklinePoint = { index: number; value: number }
  • data-slot values (to select a part by): sparkline, sparkline-active, sparkline-area, sparkline-baseline, sparkline-cursor, sparkline-dot, sparkline-extreme, sparkline-highlight, sparkline-line, sparkline-plot

Keyboard

KeyWhat it does
TabFocus an interactive sparkline: the hairline and the dot at the latest point
ArrowLeftMove the point one value back (forward in a right-to-left page), over a gap
ArrowRightMove the point one value on (back in a right-to-left page), over a gap
ArrowUpMove the point one value on
ArrowDownMove the point one value back
HomeMove the point to the first value
EndMove the point to the last value
EscapePut the point to rest

Accessibility

  • The part itself answers the keys above.
  • focus-visible: the browser's own (:focus-visible): write nothing

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

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.

goop.so/themes/trail/components/sparkline.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-sparkline.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.