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

Chart container

Pro

The card a custom chart is drawn in, for React and Tailwind CSS. Part of Goop Pro.

Point at the plot (or Tab to it and use the arrows) to read a day, and hide a series by its legend entry: the line under it says which; switch one to three series, the readout headline, the day held as the chart opens, the labels and markers, stacking (the held day’s readout sums the series), the legend beside, its toggles, whole ticks, loading, an error with Retry, and the unit. The hours are ours; Retry only counts; the day read and the series hidden are only written under it.

When to use

  • The card a custom chart is drawn in.

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 container 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>/meadow-chart.json --yes
PROMPT
Add the Goop Chart container to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import {
  ChartFitText, ChartDot, ChartSeriesMarker, ChartSeriesStroke, ChartAxisTick, ChartGrid, ChartCursor, ChartSeriesLabel, ChartAxes, ChartLines, ChartTooltipContent, ChartTooltip, ChartLegendContent,
  ChartLegend, ChartTable, ChartHeader, ChartEmpty, ChartLoading, ChartError,
} from '@/components/ui/goop/chart';

import { ChartContainer } from '@/components/ui/goop/chart';

function NotesWritten() {
  return (
    <ChartContainer
      title="Notes written"
      description="This week, by day"
      summary="Notes written and reviewed each day this week: Wednesday is the busiest."
      config={{ written: { label: 'Written' }, reviewed: { label: 'Reviewed' } }}
      categoryKey="day"
      data={[
        { day: 'Mon', written: 4, reviewed: 2 },
        { day: 'Tue', written: 6, reviewed: 5 },
        { day: 'Wed', written: 9, reviewed: 4 },
        { day: 'Thu', written: 5, reviewed: 6 },
        { day: 'Fri', written: 3, reviewed: 3 },
      ]}
    />
  );
}
  • Fits: overview: body.
  • Also known as: Chart.
  • The plot is 16:9 of the chart's width up to 352 px tall; a chart across a whole page keeps that height and grows only wider, so a chart of a few marks reads best in a column or a CardGrid cell beside another panel, not alone across a wide page.
  • height, width, padding, gap, corner, border, background, text, motion: add no class for these.

API reference

  • Each option with its sentence: chart--options.md
  • State: hiddenSeries (hiddenSeries / defaultHiddenSeries / onHiddenSeriesChange)
Parts
PartWhat it is
ChartFitTextChart text cut with an ellipsis to fit the width in max
ChartDotA point's marker in its series' shape and colour
ChartSeriesMarkerA series' marker standing alone, in the dot's box
ChartSeriesStrokeA series' line standing alone, a cell long in the dot's height
ChartAxisTickOne axis label; ChartAxes draws these for you
ChartGridFaint lines at each value tick; put it first in ChartContainer's children
ChartCursorThe line at the active point; ChartTooltip draws it
ChartSeriesLabelA series' direct label at its line's end, in the gutter the plot keeps for it, shortened to fit
ChartAxesBoth axes, categories below and values at the side
ChartLinesOne line per series through the rows you pass it
ChartTooltipContentThe tooltip's words at the active point
ChartTooltipThe panel of each series' value at the active point
ChartLegendContentThe legend's entries; with toggles each shows or hides its series
ChartLegendThe legend under the plot, from the second series (one series needs none: the title names it)
ChartTableThe data as a table, always in the page and hidden from sight
ChartHeaderThe chart card's header
ChartEmptyThe plot's empty state
ChartLoadingThe plot while its data loads
ChartErrorThe plot when it cannot draw

ChartAxes

Both axes, categories below and values at the side.

TSX
import { ChartAxes } from '@/components/ui/goop/chart';

Options

  • valuePadding?: { top?: number; bottom?: number } — Room kept at the value axis's ends, px.
  • band?: boolean — A band axis — bars: every category sits in the middle of its band.

ChartAxisTick

One axis label; ChartAxes draws these for you.

TSX
import { ChartAxisTick } from '@/components/ui/goop/chart';

Options

  • x?: number = 0 — The tick's place across, px (the library's).
  • y?: number = 0 — The tick's place down, px (the library's).
  • payload?: { value: unknown } — The tick's value: a category, or a number.
  • index?: number = 0 — The tick's place among the axis's ticks, from 0.
  • visibleTicksCount?: number — How many ticks the axis draws (the library's; not read).
  • width?: number — The axis's length, px (the library's; not read).
  • orientation?: string — The axis's side: a number on a value axis at the right starts at its tick.
  • band?: boolean — A band axis — bars: the library sets every category in the middle of its band (not read: every word is centred).
  • shown?: ReadonlySet<number> | null — The categories the axis writes, by their place from 0; all when left out.

ChartCursor

The line at the active point; ChartTooltip draws it.

TSX
import { ChartCursor } from '@/components/ui/goop/chart';

Options

  • points?: ReadonlyArray<{ x: number; y: number }> — The line's two ends, px (the library's, at the active point).

ChartDot

A point's marker in its series' shape and colour.

TSX
import { ChartDot } from '@/components/ui/goop/chart';

Options

  • series: number — The series' place in the config, from 0: its colour and its shape.
  • cx: number — The point's centre across, px.
  • cy: number — The point's centre down, px.

ChartEmpty

The plot's empty state.

TSX
import { ChartEmpty } from '@/components/ui/goop/chart';

Options

  • children?: ReactNode = 'No data to show.' — The empty state's words.

ChartError

The plot when it cannot draw.

TSX
import { ChartError } from '@/components/ui/goop/chart';

Options

  • children: ReactNode — The error's sentence.
  • onRetry?: () => void — Called by the retry button; none is drawn without it.
  • retryLabel?: string = 'Retry' — The retry button's words.

ChartFitText

Chart text cut with an ellipsis to fit the width in max.

TSX
import { ChartFitText } from '@/components/ui/goop/chart';

Options

  • text: string — The words; drawn whole when they fit.
  • max: number — The widest the words may be drawn, px.

ChartGrid

Faint lines at each value tick; put it first in ChartContainer's children.

TSX
import { ChartGrid } from '@/components/ui/goop/chart';

Options

ChartLegendContent

The legend's entries; with toggles each shows or hides its series.

TSX
import { ChartLegendContent } from '@/components/ui/goop/chart';

Options

  • toggles?: boolean = false — Each entry hides or shows its series.
  • strokes?: boolean = false — Each series as a short length of its line, rather than its marker.

ChartLegend

The legend under the plot, from the second series (one series needs none: the title names it).

TSX
import { ChartLegend } from '@/components/ui/goop/chart';

Options

  • toggles?: boolean = false — Each entry hides or shows its series.
  • strokes?: boolean = false — Each series stands as a short length of its line rather than its marker.

ChartLines

One line per series through the rows you pass it.

TSX
import { ChartLines } from '@/components/ui/goop/chart';

Options

  • data: readonly object[] — The chart's rows, in the category axis's order.
  • encode?: boolean = true — The second encoding: the direct labels and a dash from the third series.
  • markers?: boolean — Every point in its series' marker (true), or none ever (false).
  • labels?: boolean = true — The direct labels at the lines' ends; off where a legend of the lines' strokes names them.

ChartLoading

The plot while its data loads.

TSX
import { ChartLoading } from '@/components/ui/goop/chart';

Options

ChartContainer: every option

TSX
import { ChartContainer } from '@/components/ui/goop/chart';

Options

  • title: string — The chart's title, in its header; it names the chart.
  • description?: string — A line under the title.
  • summary: string — What the chart shows, in one sentence: its description for a person who cannot see it (required).
  • action?: ReactNode — The range control at the header's end, none by default: segmented Tabs whose triggers name panelId with aria-controls, or a Select.
  • panelId?: string — The id of the chart's body as the ONE panel a tab strip in the header switches.
  • 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.
  • encode?: boolean = true — The second encoding, on by default: a direct label at each line's end, a dash from the third series.
  • markers?: boolean — Every point in its series' marker (true), or none ever (false).
  • locale?: string — The numbers' locale; the document's language by default.
  • format?: Intl.NumberFormatOptions — The numbers' Intl.NumberFormat options.
  • unit?: string — The words after a full value (the tooltip, the table); in the readout, set small after the number.
  • loading?: boolean = false — The data is loading: one skeleton block fills the plot's box where the marks will be.
  • error?: string — Why the chart cannot draw: the error state says it.
  • onRetry?: () => void — The error state's retry.
  • defaultIndex?: number — The point whose tooltip shows when the chart mounts (a preview, a held picture).
  • readout?: ChartReadout — The readout layout: the headline in the card under the title, at rest this, following the active item.
  • plot?: ChartPlot — The chart library's chart element the ready plot is drawn with: its line chart by default.
  • children?: ReactNode — What is drawn in the ready plot: by default the grid, the axes, the tooltip and the line layer.
  • endLabels?: boolean | 'always' — Whether the plot keeps a gutter for direct labels at its end edge: by default when no children are given and two series or more are drawn.
  • legend?: ReactNode — What stands where the legend stands, in the ready state alone: by default the series' legend, from the second.
  • scrub?: boolean — The plot is a slider over its categories: arrows, PageUp and PageDown (seven), Home and End move the active point, Escape puts it to rest.
  • toggles?: boolean — The default legend's entries hide and show their series: by default, when no children are given.
  • stack?: boolean = false — The series stack: an active item's number in the readout is their sum.
  • legendBeside?: boolean = false — Sets the legend beside the plot where the card's body is 36rem wide or more, under it when narrower; off by default.
  • wholeNumbers?: boolean — The value axis writes whole numbers alone, never 0.75 or 2.5: by default when every value of every series is whole.
  • otherLabel?: string = 'Other' — The label of the series that holds the rest where more than five are given: the four with the largest totals are drawn as given and the others summed into this one, drawn last, its legend entry naming them.
  • hiddenSeries?: readonly string[] — The hidden series' keys, held by the caller.
  • defaultHiddenSeries?: readonly string[] — The series hidden at first.
  • onHiddenSeriesChange?: (hidden: string[]) => void — Called with the hidden keys as a toggle changes them.
  • onActiveIndexChange?: (index: number | null) => void — Called with the active row's index, null at rest.
  • State: hiddenSeries (hiddenSeries / defaultHiddenSeries / onHiddenSeriesChange)
  • Types: ChartReadout = { label: string; value: number | 'total' | 'average'; detail?: string; change?: number; measure?: string; compare?: string }

ChartSeriesLabel

A series' direct label at its line's end, in the gutter the plot keeps for it, shortened to fit.

TSX
import { ChartSeriesLabel } from '@/components/ui/goop/chart';

Options

  • x: number — The line's last point across, px.
  • y: number — The line's last point down, px.
  • children: string — The series' label.

ChartSeriesMarker

A series' marker standing alone, in the dot's box.

TSX
import { ChartSeriesMarker } from '@/components/ui/goop/chart';

Options

  • series: number — The series' place in the config, from 0: its colour and its shape.

ChartSeriesStroke

A series' line standing alone, a cell long in the dot's height.

TSX
import { ChartSeriesStroke } from '@/components/ui/goop/chart';

Options

  • series: number — The series' place in the config, from 0: its colour and its dash.

ChartTable

The data as a table, always in the page and hidden from sight.

TSX
import { ChartTable } from '@/components/ui/goop/chart';

Options

  • data: readonly object[] — The chart's rows.
  • title: string — The chart's title, which names the table.

ChartTooltipContent

The tooltip's words at the active point.

TSX
import { ChartTooltipContent } from '@/components/ui/goop/chart';

Options

  • label?: unknown — The active point's category (the library's).
  • payload?: ReadonlyArray<{ payload?: ChartRow }> — The active point's entries (the library's): the row they are of is read.
  • strokes?: boolean = false — Each series keyed by a short length of its line, rather than its marker.

ChartTooltip

The panel of each series' value at the active point.

TSX
import { ChartTooltip } from '@/components/ui/goop/chart';

Options

  • defaultIndex?: number — The point whose tooltip shows when the chart mounts.
  • offset?: number — How far the panel stands from the active point, px (10 by default).
  • cursor?: ReactElement — The cursor at the active point: by default the line down the plot.
  • panel?: boolean = true — Whether the panel is drawn.
  • strokes?: boolean = false — The panel keys each series by its stroke, as a legend of strokes does.

Keyboard

KeyWhat it does
TabFocus the plot
ArrowLeftMove the active point one category
ArrowRightMove the active point one category

Accessibility

  • The native element answers the keyboard.

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.

goop.so/themes/meadow/components/chart.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-chart.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.