Skip to main content

Navigator

Analytics and Interaction

An overview strip under a chart that shows the whole series and a draggable window onto it.

import { ChartNavigator } from "@elabs-ai/components-charts";
Install
npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-charts

Skipping the @source line is the most common first failure: Tailwind does not scan node_modules, so every component renders unstyled. The one-time wiring

Prompt for your coding agent

Paste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.

Add the brand-ui ChartNavigator chart (from @elabs-ai/components-charts) to this project.

1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`.
2. Look ChartNavigator up before writing code: `npx -y @elabs-ai/components-cli docs ChartNavigator` prints its real props, variants, what it pairs with and what to avoid.
3. If @elabs-ai/components-charts is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-charts` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-charts`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`.
4. Use it here: [the screen or file, and what it should show]
5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop.
6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.

Examples

8 live examples

Controlled Shared Window

One controlled `window` shared by two charts: moving either strip moves both plots. Keyboard: Tab to a handle; arrows step one month (the median data step), Shift+arrows ten, Home/End to the handle's bounds, PageUp/PageDown pan by a whole window.

Align End Live Feed

`align="end"` (the associative BI suite `scrollStartPos: 1`): the first window sits on the latest data, and — until someone moves it — keeps following the feed as rows arrive.

Scrollbar

`scrollbar="bar"`: the same window and handles as a plain 24 px scrollbar — no shadow.

Min Span Clamp

`minSpan` — the smallest window the handles allow (here 30 days; the default is 5× the median step). A handle stops `minSpan` short of the other one.

Narrow Tier

The narrow tier (a 380 px container): the strip drops to 32 px; the window, handles and keyboard contract are unchanged.

Standalone Index

The strip on its own — an `index` window over 480 rows (the category model RM-141 builds on). The handles speak rows: "Row 121 of 480".

Pinch Zoom

Pinch-to-zoom, on by default with no strip: spread two fingers on a touch screen, pinch a trackpad, or hold Ctrl/⌘ and wheel. A two-finger drag pans. With the chart focused, `+` / `−` / `0` do the same; once zoomed, the zoom buttons (zoom in, zoom out, reset) appear in the plot's corner. One finger still scrubs the tooltip horizontally and scrolls the page vertically. `zoom={false}` hands every gesture back to the page.

API

ChartNavigator

PropTypeDescription
kindrequired"time" | "index"`time`: the extent and windows are Dates; `index`: row numbers (`end` exclusive).
extentrequired[Date, Date] | [number, number]The full data extent: `[firstDate, lastDate]` or `[0, rowCount]`.
windowNavigatorWindow | nullControlled window; `null` = the whole extent.
defaultWindowNavigatorWindowInitial window when uncontrolled. Default: the whole extent.
onWindowChange(window: NavigatorWindow, meta: NavigatorChangeMeta) => void
minSpannumberSmallest window: ms (time) or rows (index). Default 5× median step / 3 rows.
align"start" | "end"Where the uncontrolled first window sits when only `minSpan`-free defaults apply.
datareadonly Record<string, unknown>[]The rows behind the shadow (and the median step for time).
valueKeysreadonly string[]Series keys pooled into the shadow.
xAccessor(row: Record<string, unknown>) => Date | numberA row's x (time kind). Default: `row.date`. Ignored for index.
stackedbooleanPool the stack total per row instead of each value.
orientation"horizontal" | "vertical"Default `"horizontal"`. `"vertical"` runs top → bottom (RM-141).
scrollbar"miniChart" | "bar"`"miniChart"` (shadow + window, default) or `"bar"` (window only).
lengthnumberMain-axis length in px; measured from the element when omitted.
thicknessnumberCross-axis thickness in px. Default per style and tier (40 / 32 / 24).
inset{ start?: number; end?: number }Main-axis padding (px) so the window lines up with a plot's inner range.
stepnumberOne arrow-key step: ms (time) or rows (index). Default: the median data step / 1 row.

Also accepts: ChartNavigatorStripProps