Components · Data Display
Chart Toggle
BetaAdded v4.6.0
A legend whose entries switch series on and off, wrapped around any chart.
import { ChartToggle } from '@nexub/react';Playground
Props
| m | Web | iOS | Android |
|---|---|---|---|
| May | 120 | 80 | 60 |
| Jun | 140 | 95 | 72 |
| Jul | 150 | 110 | 90 |
| Aug | 170 | 128 | 101 |
<ChartToggle series={series} className="w-full">…</ChartToggle>Examples
Toggle series
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| seriesrequired | ChartSeries[] | — | The same series the chart takes. |
| childrenrequired | (visible: ChartSeries[]) => React.ReactNode | — | Renders the chart with the series that are on. Colours stay stable. |
| label | string | 'Series' | Accessible name for the group of toggles. |
| className | string | — |
Accessibility
Keyboard
- Tab / Space
Move between series and switch one on or off.
Screen reader
Each series is a toggle button with `aria-pressed`. The last visible series cannot be switched off.
On iOS & Android
Web only
Chart Toggle has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.