Skip to content
InsightCharts

Search

Search guides and components

Filter chips

The active crossfilter selections of the surrounding `InsightData`, shown as removable chips with a reset control.

Use when
Inside any <InsightData> whose charts use select: put it above the charts so readers can see what is filtered, drop one value, or clear everything. linked charts already includes it.
Avoid when
Outside <InsightData> it renders nothing unless you pass selections yourself. It is not a filter builder: selections are made by clicking marks in the charts.

Preview

Filtered by

Composition

Built from

Filter chips is built from plain HTML and lists no other component in its composes.

Used in

1 molecule and 1 template use filter chips.

Molecules

1

Two to four charts over one shared dataset in a responsive grid: clicking a mark in one filters the others, with the active filters shown as removable chips.

Templates

1

A set of linked charts over one shared dataset that filter each other. It has a headline, a sentence of instructions with filter chips, a row of figures that recompute from the filtered rows, two to four charts and an optional detail table. It opens on selections the author chooses.

Directly, and throughLinked charts

Installation

$ pnpm dlx shadcn@latest add @insightcharts/filter-chips

The CLI copies the source into your project and needs the @insightcharts registry in components.json; see installation. With the package, import it by name:

import { FilterChips } from "insightcharts";

Examples

Nothing selected, with a hint

Click a bar to filter

Props

PropTypeDefaultDescription
selectionsRecord<string, { field, values?, range? }>Selections to show when there is no surrounding <InsightData> (or to override it), keyed by owner. Uncontrolled unless onSelectionsChange is given.
onSelectionsChange(selections) => voidCalled when a chip is removed or the reset is pressed; makes selections controlled.
labelsRecord<string, string>Display names for field names, e.g. { region: "Region" }.
hintstringShown while nothing is selected, e.g. "Click a bar to filter".
resetLabelstring"Reset"Text of the clear-all control.
countbooleanfalseShow "1,204 of 5,000 rows" at the end of the line.
unitstring"rows"Noun for the count, e.g. "orders".
themeThemeInputTheme override.
mode"auto" | "system" | "light" | "dark""auto"Colour mode.