diff --git a/bundle-size-baseline.json b/bundle-size-baseline.json
index ecf7d072a..e7eb32e80 100644
--- a/bundle-size-baseline.json
+++ b/bundle-size-baseline.json
@@ -224,7 +224,7 @@
{
"name": "@databricks/appkit-ui",
"tarball": {
- "packed": 406329,
+ "packed": 511622,
"unpacked": 1585067
},
"dist": {
@@ -307,7 +307,7 @@
"composition": {
"initialGzip": 452157,
"lazyGzip": 49772,
- "totalGzip": 501929,
+ "totalGzip": 534461,
"own": 185337,
"nodeModules": 1417035,
"chunks": [
diff --git a/docs/docs/api/appkit-ui/data/AreaChart.mdx b/docs/docs/api/appkit-ui/data/AreaChart.mdx
index 59ce64da1..f2924942d 100644
--- a/docs/docs/api/appkit-ui/data/AreaChart.mdx
+++ b/docs/docs/api/appkit-ui/data/AreaChart.mdx
@@ -6,25 +6,40 @@ Area Chart component for trend visualization with filled areas.
## Example
```tsx
-"use client";
-
import { AreaChart } from "@databricks/appkit-ui/react";
+// Long rows as `config/queries/revenue_by_channel.sql` returns them, one row
+// per month and channel; `seriesKey` turns each channel into a stacked band.
+// SELECT DATE_TRUNC('MONTH', order_date) AS month, channel,
+// CAST(SUM(amount) AS DOUBLE) AS revenue
+// FROM orders GROUP BY 1, 2 ORDER BY 1
+const rows = [
+ { month: "2026-01-01", channel: "Online", revenue: 412000 },
+ { month: "2026-01-01", channel: "Retail", revenue: 268000 },
+ { month: "2026-02-01", channel: "Online", revenue: 451000 },
+ { month: "2026-02-01", channel: "Retail", revenue: 259000 },
+ { month: "2026-03-01", channel: "Online", revenue: 498000 },
+ { month: "2026-03-01", channel: "Retail", revenue: 281000 },
+ { month: "2026-04-01", channel: "Online", revenue: 530000 },
+ { month: "2026-04-01", channel: "Retail", revenue: 274000 },
+];
+
+const usd = (value: string | number) =>
+ new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+ notation: "compact",
+ }).format(Number(value));
+
export default function AreaChartExample() {
return (
);
@@ -37,11 +52,19 @@ export default function AreaChartExample() {
Area Chart component for trend visualization with filled areas.
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** the split of a total changes over time (stacked), or for a running total.
+
+**Not when:** up to 12 periods (stacked BarChart); over 5 parts (top 4 plus "Other" in SQL); values of mixed sign.
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per period and part: long rows plus `seriesKey`, or one column per part.
+
+**Gotchas:** pass `stacked` for composition; unstacked areas overlap. A stack of mixed-sign values logs a warning.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/area/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/area/index.tsx)
@@ -54,33 +77,44 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
-| `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation |
+| `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation. Horizontal orientation renders bars. @deprecated Use BarChart for horizontal bars. |
+| `sparkline` | `boolean` | | - | A KPI-tile sparkline: no axes, legend or margins, the y range fitted to the data, a gap at missing values, and a dot when there is one point. Height defaults to 48 px. |
+| `symbolSize` | `number` | | `8` | Size of the data point symbols |
| `showSymbol` | `boolean` | | `false` | Show data point symbols |
-| `smooth` | `boolean` | | `true` | Smooth line curves |
+| `smooth` | `boolean` | | `true (false with `defaults="v3"`)` | Smooth line curves. |
+| `connectNulls` | `boolean` | | `false` | Draw the line across missing values instead of leaving a gap. Only applies with `defaults="v3"`, where missing values stay missing. |
| `stacked` | `boolean` | | `false` | Stack areas |
+| `referenceLines` | `ChartReferenceLine[]` | | - | Target or reference lines across the plot, at values of the value axis (`[{ value: 100, label: "Target" }]`). |
+| `zoom` | `boolean` | | `false` | Zoom along the category or time axis: mouse wheel and drag in the plot, plus a slider. Use it for long series. |
+| `series` | `Record` | | - | Per-`yKey` series type and value axis, for combo charts and a second y axis: `series={{ margin_pct: { type: "line", axis: "right" } }}` on a BarChart draws `margin_pct` as a line against its own axis. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { AreaChart } from '@databricks/appkit-ui';
+import { AreaChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/BarChart.mdx b/docs/docs/api/appkit-ui/data/BarChart.mdx
index c016e9add..a82303040 100644
--- a/docs/docs/api/appkit-ui/data/BarChart.mdx
+++ b/docs/docs/api/appkit-ui/data/BarChart.mdx
@@ -6,22 +6,35 @@ Bar Chart component for categorical comparisons.
## Example
```tsx
-"use client";
-
import { BarChart } from "@databricks/appkit-ui/react";
+// Rows as `config/queries/revenue_by_segment.sql` returns them:
+// SELECT segment, CAST(SUM(amount) AS DOUBLE) AS revenue
+// FROM orders GROUP BY segment ORDER BY revenue DESC LIMIT 10
+// In an app, pass the query instead of the rows:
+//
+const rows = [
+ { segment: "Enterprise", revenue: 1840500 },
+ { segment: "Mid-market", revenue: 1215300 },
+ { segment: "SMB", revenue: 864200 },
+ { segment: "Public sector", revenue: 512900 },
+ { segment: "Education", revenue: 301750 },
+];
+
+const usd = (value: string | number) =>
+ new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+ notation: "compact",
+ }).format(Number(value));
+
export default function BarChartExample() {
return (
);
@@ -34,11 +47,19 @@ export default function BarChartExample() {
Bar Chart component for categorical comparisons.
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** comparing one measure across 3 to 15 categories, or across up to 12 periods.
+
+**Not when:** more than 15 categories (DataTable); more than 12 periods (LineChart); 2 to 5 parts of one whole (DonutChart); one category (a KPI tile).
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per category, already sorted in SQL; a category column (text) and a measure column (number). Several series: one measure column each, or long rows plus `seriesKey`.
+
+**Gotchas:** text categories keep their row order; numeric x values sort ascending. Use `xType="category"` to keep numeric categories in row order. Pass `orientation` if the automatic rule picks the wrong one. Cast DECIMAL to DOUBLE in SQL, or pass the strings: both parse.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/bar/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/bar/index.tsx)
@@ -51,31 +72,40 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
-| `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation |
-| `stacked` | `boolean` | | - | Stack bars |
+| `orientation` | `"horizontal" \| "vertical"` | | - | Bar orientation. When unset, dates are vertical and category labels are horizontal. With `defaults="v3"`: dates, numbers (such as years) and up to 7 labels of at most 10 characters are vertical; anything else is horizontal. |
+| `stacked` | `boolean` | | `false` | Stack the series, on vertical and horizontal bars. |
+| `referenceLines` | `ChartReferenceLine[]` | | - | Target or reference lines across the plot, at values of the value axis (`[{ value: 100, label: "Target" }]`). |
+| `zoom` | `boolean` | | `false` | Zoom along the category or time axis: mouse wheel and drag in the plot, plus a slider. Use it for long series. |
+| `showValues` | `boolean` | | `false` | Print each bar's (or point's) value next to it. |
+| `series` | `Record` | | - | Per-`yKey` series type and value axis, for combo charts and a second y axis: `series={{ margin_pct: { type: "line", axis: "right" } }}` on a BarChart draws `margin_pct` as a line against its own axis. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { BarChart } from '@databricks/appkit-ui';
+import { BarChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/DataTable.mdx b/docs/docs/api/appkit-ui/data/DataTable.mdx
index 00c4fb15f..2529d8360 100644
--- a/docs/docs/api/appkit-ui/data/DataTable.mdx
+++ b/docs/docs/api/appkit-ui/data/DataTable.mdx
@@ -6,17 +6,37 @@ Production-ready data table with automatic data fetching and state management
## Example
```tsx
-"use client";
-
import { DataTable } from "@databricks/appkit-ui/react";
+// Detail rows with typed columns. In an app, pass the query instead of rows:
+//
+const rows = [
+ { order_id: "00412", customer: "Acme", amount: 1840.5, shipped: true },
+ { order_id: "00413", customer: "Globex", amount: 215.0, shipped: false },
+ { order_id: "00414", customer: "Initech", amount: 9310.25, shipped: true },
+ { order_id: "00415", customer: "Hooli", amount: null, shipped: false },
+];
+
+const usd = new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+});
+
export default function DataTableExample() {
return (
(value == null ? "—" : usd.format(Number(value))),
+ align: "right",
+ },
+ { key: "shipped" },
+ ]}
+ defaultSort={{ key: "amount", desc: true }}
pageSize={10}
/>
);
@@ -29,6 +49,15 @@ export default function DataTableExample() {
Production-ready data table with automatic data fetching and state management
+**Use when:** readers need the exact records (detail rows, a top N with a link column).
+
+**Not when:** one number (a KPI tile) or a trend (a chart). On a dashboard, pick at most 8 columns with `columns`.
+
+**Rows:** detail rows with aliased snake_case columns; pass `queryKey` or `data`.
+
+**Gotchas:** formats come from the values, so cast in SQL what should read as a number, and use `columns` for
+labels, money and percent formats, widths and link cells.
+
Features:
- Automatic column generation from data structure
- Integrated with useAnalyticsQuery for data fetching
@@ -38,11 +67,11 @@ Features:
- Responsive design
- Supports opinionated mode (auto columns) and full-control mode (`children(table)`)
-In opinionated mode the columns are the keys of the first row that match `/^[a-zA-Z_][a-zA-Z0-9_]*$/` (other
-keys are dropped), headed by the key in Title Case. Every cell whose value parses as a number, numeric strings
-included, is right-aligned and formatted: a key containing `cost`, `price`, `spend`, `revenue` or `usd` shows as
-USD, and any other value of 1000 or more is abbreviated (10021 shows as 10K). For ids, zip codes or years, render
-a `Table` from `useAnalyticsQuery` rows instead.
+In opinionated mode the columns are `columns` when given, otherwise every key of the first row, headed by the key
+in Title Case (a key such as `count(1)` is shown as written). Cells are formatted by the column's type, inferred from all
+of its values and never from its name: numbers (and numeric text such as DECIMAL strings) are right-aligned at full
+precision, with separators above four digits; text with a leading zero ("02134") stays text; booleans show as
+true/false; timestamps as `YYYY-MM-DD HH:MM:SS`; objects as JSON; null and empty values as a dash.
**Source:** [`packages/appkit-ui/src/react/table/data-table.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/table/data-table.tsx)
@@ -52,19 +81,28 @@ a `Table` from `useAnalyticsQuery` rows instead.
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
-| `queryKey` | `string` | ✓ | - | The query key to fetch the data |
-| `parameters` | `Record` | ✓ | - | The parameters to pass to the query |
-| `filterColumn` | `string` | | - | The column to filter by |
+| `queryKey` | `string` | | - | The query key to fetch the data |
+| `parameters` | `Record` | | - | The parameters to pass to the query. Optional, as on charts. |
+| `loading` | `boolean` | | - | Show the loading state in data mode; ignored in query mode. |
+| `error` | `string \| Error \| null` | | - | Show an error in data mode; ignored in query mode. |
+| `data` | `ChartDataInput` | | - | Rows to show, or an Arrow Table: the same contract as a chart's `data`. Use it for stub rows while building the UI, Lakebase rows, or a result already fetched with `useAnalyticsQuery` for a chart on the same screen. |
+| `defaultSort` | `DataTableSort` | | - | Initial sort, e.g. `{ key: "revenue", desc: true }`. Headers show the direction and set `aria-sort`. |
+| `columns` | `DataTableColumn[]` | | - | Columns to show, in order, with label, format, alignment, width and custom cell content. Defaults to every key of the first row with the format inferred from the values. |
+| `toolbar` | `boolean \| { search?: boolean; columns?: boolean; } \| undefined` | | `true` | The toolbar above the table: a search box and a Columns menu. `false` hides it; an object hides either part. |
+| `filterColumn` | `string` | | - | Filter only this column. Without it, the search box matches any column. |
| `filterPlaceholder` | `string` | | - | Optional placeholder for the filter input |
-| `transform` | `((data: any[]) => any[])` | | - | Optional function to transform data before creating table. A new function reference re-runs it and resets the table to the first page, so keep it stable: define it outside the component, or rely on the React Compiler (enabled in the AppKit template); without the compiler, wrap it in `useCallback`. |
+| `transform` | `((data: any[]) => any[])` | | - | Optional function to transform data before creating table (rows in, rows out). An inline function is fine: when it returns the same rows the table keeps its page and columns. |
| `labels` | `DataTableLabels` | | - | Optional labels for the DataTable component |
| `ariaLabel` | `string` | | - | Optional accessibility label for the DataTable component |
| `testId` | `string` | | - | Optional test ID for the DataTable component |
| `className` | `string` | | - | Optional CSS class name for the DataTable component |
| `enableRowSelection` | `boolean` | | - | Enable row selection with checkboxes |
-| `onRowSelectionChange` | `((rowSelection: RowSelectionState) => void)` | | - | Callback function to handle row selection changes |
+| `onRowSelectionChange` | `((rowSelection: RowSelectionState) => void)` | | - | Callback function to handle row selection changes (TanStack index map; prefer `onSelectionChange`) |
+| `onSelectionChange` | `((rows: any[]) => void)` | | - | Called with the selected rows themselves whenever the selection changes. Needs `enableRowSelection`. Rows are selected by position, so a new `data` array clears the selection. Memoize `data` to keep it across renders. |
+| `onRowClick` | `((row: any) => void)` | | - | Called with the row when a row is clicked, or activated with Enter. Rows become focusable. |
| `children` | `((table: Table) => ReactNode)` | | - | Optional children for full control mode |
| `pageSize` | `number` | | - | Number of rows to display per page |
+| `maxHeight` | `string \| number` | | `600` | Height at which the table body scrolls (pixels or a CSS length), with the header kept in view. |
| `pageSizeOptions` | `number[]` | | - | Options for the page size selector |
@@ -72,7 +110,7 @@ a `Table` from `useAnalyticsQuery` rows instead.
### Usage
```tsx
-import { DataTable } from '@databricks/appkit-ui';
+import { DataTable } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/DonutChart.mdx b/docs/docs/api/appkit-ui/data/DonutChart.mdx
index 42bed7fb6..5f62910fe 100644
--- a/docs/docs/api/appkit-ui/data/DonutChart.mdx
+++ b/docs/docs/api/appkit-ui/data/DonutChart.mdx
@@ -6,19 +6,25 @@ Donut Chart component (Pie chart with inner radius).
## Example
```tsx
-"use client";
-
import { DonutChart } from "@databricks/appkit-ui/react";
+// Headcount by department, with the total in the hole.
+// SELECT department, COUNT(*) AS headcount FROM employees
+// GROUP BY department ORDER BY headcount DESC
+const rows = [
+ { department: "Engineering", headcount: 450 },
+ { department: "Sales", headcount: 300 },
+ { department: "Marketing", headcount: 250 },
+ { department: "Operations", headcount: 200 },
+];
+
export default function DonutChartExample() {
return (
);
@@ -31,11 +37,19 @@ export default function DonutChartExample() {
Donut Chart component (Pie chart with inner radius).
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** 2 to 5 parts of one whole, with the total in the hole (`centerLabel`).
+
+**Not when:** 6 or more parts, or parts of similar size (horizontal BarChart); negative values (BarChart).
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per part, sorted descending: a name column and a value column. Pass both keys.
+
+**Gotchas:** `innerRadius` is clamped to 63; `innerRadius={0}` draws a pie.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/pie/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/pie/index.tsx)
@@ -48,32 +62,38 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
-| `innerRadius` | `number` | | `0` | Inner radius for donut charts (0-100%) |
-| `showLabels` | `boolean` | | `true` | Show labels on slices |
+| `innerRadius` | `number` | | `0 (40 on DonutChart)` | Hole radius in percent of the chart, clamped to 0 to 63 (90% of the outer radius). `0` draws a plain pie, also on DonutChart. |
+| `showLabels` | `boolean` | | `true (false with `defaults="v3"`, where the legend shows name, value and share)` | Show labels on slices. |
| `labelPosition` | `"center" \| "outside" \| "inside"` | | `"outside"` | Label position |
+| `centerLabel` | `string \| boolean` | | `true on a v3 DonutChart` | Text in the donut hole, sized to fit it. `true` shows the formatted total (compacted, e.g. "9.7M", when the full number doesn't fit). Ignored on a pie without a hole. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { DonutChart } from '@databricks/appkit-ui';
+import { DonutChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/HeatmapChart.mdx b/docs/docs/api/appkit-ui/data/HeatmapChart.mdx
index 48a959935..2de5315f2 100644
--- a/docs/docs/api/appkit-ui/data/HeatmapChart.mdx
+++ b/docs/docs/api/appkit-ui/data/HeatmapChart.mdx
@@ -6,31 +6,31 @@ Heatmap Chart component for matrix-style data visualization.
## Example
```tsx
-"use client";
-
import { HeatmapChart } from "@databricks/appkit-ui/react";
-export default function HeatmapChartExample() {
- const data = [];
- const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
- const hours = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"];
-
- for (const day of days) {
- for (const hour of hours) {
- data.push({
- day,
- hour,
- count: Math.floor(Math.random() * 100),
- });
- }
- }
+// One row per cell, as `config/queries/orders_by_hour.sql` returns them.
+// Weekdays are put in calendar order whatever the row order.
+// SELECT DATE_FORMAT(created_at, 'E') AS weekday, HOUR(created_at) AS hour,
+// COUNT(*) AS orders
+// FROM orders GROUP BY 1, 2
+const weekdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
+const hours = [8, 10, 12, 14, 16, 18];
+const rows = weekdays.flatMap((weekday, d) =>
+ hours.map((hour, h) => ({
+ weekday,
+ hour,
+ // Busy at lunch and on weekdays: a fixed pattern, not random data.
+ orders: (d < 5 ? 60 : 25) + (h === 2 ? 40 : 0) + ((d * 7 + h * 3) % 11),
+ })),
+);
+export default function HeatmapChartExample() {
return (
);
@@ -43,16 +43,24 @@ export default function HeatmapChartExample() {
Heatmap Chart component for matrix-style data visualization.
+**Use when:** finding where a measure is high or low across two dimensions (weekday by hour, cohort by period).
+
+**Not when:** under 3 by 3 cells (grouped BarChart); over 30 columns (aggregate in SQL).
+
+**Rows:** one per cell; name the roles with `columnKey`, `rowKey` and `valueKey`.
+
+**Gotchas:** repeated cells are summed with a warning; weekdays, months, numbers and dates are put in order (`xOrder`/`yOrder` override). Use `colorPalette="diverging"` for values around 0.
+
**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
Data should be in "long format" with three fields:
-- xKey: X-axis category (columns)
-- yAxisKey: Y-axis category (rows)
-- yKey: The numeric value for each cell
-
-Supports both query mode (queryKey + parameters) and data mode (static data).
+- columnKey (or xKey): X-axis category (columns)
+- rowKey (or yAxisKey): Y-axis category (rows)
+- valueKey (or yKey): The numeric value for each cell
**Source:** [`packages/appkit-ui/src/react/charts/heatmap/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/heatmap/index.tsx)
@@ -65,33 +73,43 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
| `yAxisKey` | `string` | | - | Field key for the Y-axis categories. For heatmaps, data should have: xKey (column), yAxisKey (row), and yKey (value). |
| `min` | `number` | | - | Min value for color scale (auto-detected if not provided) |
| `max` | `number` | | - | Max value for color scale (auto-detected if not provided) |
-| `showLabels` | `boolean` | | `false` | Show value labels on cells |
+| `showLabels` | `boolean` | | - | Show value labels on cells. Unset: on for up to 100 cells when each cell is wide enough for a label. |
+| `xOrder` | `readonly (string \| number)[]` | | - | Column order: these values first, in this order. Unset: weekdays and months in calendar order, numbers ascending, dates chronologically, other text in row order. |
+| `yOrder` | `readonly (string \| number)[]` | | - | Row order, as HeatmapChartSpecificProps.xOrder. |
+| `columnKey` | `string` | | - | The column dimension; same as `xKey`. |
+| `rowKey` | `string` | | - | The row dimension; same as `yAxisKey`. |
+| `valueKey` | `string` | | - | The numeric cell value; same as `yKey`. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { HeatmapChart } from '@databricks/appkit-ui';
+import { HeatmapChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/LineChart.mdx b/docs/docs/api/appkit-ui/data/LineChart.mdx
index eaa662d00..ff60495a7 100644
--- a/docs/docs/api/appkit-ui/data/LineChart.mdx
+++ b/docs/docs/api/appkit-ui/data/LineChart.mdx
@@ -6,24 +6,31 @@ Line Chart component for time-series and trend visualization.
## Example
```tsx
-"use client";
-
import { LineChart } from "@databricks/appkit-ui/react";
+// Rows as `config/queries/daily_orders.sql` returns them: a DATE column and a
+// count, one row per day. A day with no data is null and shows as a gap with
+// `defaults="v3"`.
+// SELECT order_date, COUNT(*) AS orders FROM orders
+// WHERE order_date >= :start_date GROUP BY order_date ORDER BY order_date
+// In an app:
+const rows = [
+ { order_date: "2026-03-01", orders: 182 },
+ { order_date: "2026-03-02", orders: 205 },
+ { order_date: "2026-03-03", orders: 198 },
+ { order_date: "2026-03-04", orders: null },
+ { order_date: "2026-03-05", orders: 231 },
+ { order_date: "2026-03-06", orders: 264 },
+ { order_date: "2026-03-07", orders: 249 },
+];
+
export default function LineChartExample() {
return (
);
@@ -36,11 +43,19 @@ export default function LineChartExample() {
Line Chart component for time-series and trend visualization.
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** a measure changes over time.
+
+**Not when:** under 4 periods (vertical BarChart); over 5 series (top 4 plus "Other" in SQL).
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per period, a DATE or TIMESTAMP column and a measure; several series as one column each or long rows plus `seriesKey`.
+
+**Gotchas:** the x axis is a time axis only when every `xKey` value is a date. Missing values draw as 0 unless `defaults="v3"`, which leaves a gap. Lines are smoothed unless `smooth={false}` or `defaults="v3"`. For a KPI tile use `sparkline`.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/line/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/line/index.tsx)
@@ -53,32 +68,43 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
-| `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation |
+| `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation. Horizontal orientation renders bars. @deprecated Use BarChart for horizontal bars. |
+| `sparkline` | `boolean` | | - | A KPI-tile sparkline: no axes, legend or margins, the y range fitted to the data, a gap at missing values, and a dot when there is one point. Height defaults to 48 px. |
+| `symbolSize` | `number` | | `8` | Size of the data point symbols |
| `showSymbol` | `boolean` | | `false` | Show data point symbols |
-| `smooth` | `boolean` | | `true` | Smooth line curves |
+| `smooth` | `boolean` | | `true (false with `defaults="v3"`)` | Smooth line curves. |
+| `connectNulls` | `boolean` | | `false` | Draw the line across missing values instead of leaving a gap. Only applies with `defaults="v3"`, where missing values stay missing. |
+| `referenceLines` | `ChartReferenceLine[]` | | - | Target or reference lines across the plot, at values of the value axis (`[{ value: 100, label: "Target" }]`). |
+| `zoom` | `boolean` | | `false` | Zoom along the category or time axis: mouse wheel and drag in the plot, plus a slider. Use it for long series. |
+| `series` | `Record` | | - | Per-`yKey` series type and value axis, for combo charts and a second y axis: `series={{ margin_pct: { type: "line", axis: "right" } }}` on a BarChart draws `margin_pct` as a line against its own axis. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { LineChart } from '@databricks/appkit-ui';
+import { LineChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/PieChart.mdx b/docs/docs/api/appkit-ui/data/PieChart.mdx
index 60def78b4..83a74e8d5 100644
--- a/docs/docs/api/appkit-ui/data/PieChart.mdx
+++ b/docs/docs/api/appkit-ui/data/PieChart.mdx
@@ -6,22 +6,20 @@ Pie Chart component for proportional data visualization.
## Example
```tsx
-"use client";
-
import { PieChart } from "@databricks/appkit-ui/react";
+// Two to five parts of one whole, as `config/queries/tickets_by_priority.sql`
+// returns them. More parts, or parts of similar size, read better as a bar chart.
+// SELECT priority, COUNT(*) AS tickets FROM tickets GROUP BY priority ORDER BY tickets DESC
+const rows = [
+ { priority: "Low", tickets: 412 },
+ { priority: "Medium", tickets: 268 },
+ { priority: "High", tickets: 121 },
+ { priority: "Urgent", tickets: 37 },
+];
+
export default function PieChartExample() {
- return (
-
- );
+ return ;
}
```
@@ -31,11 +29,19 @@ export default function PieChartExample() {
Pie Chart component for proportional data visualization.
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** 2 to 5 parts of one whole.
+
+**Not when:** 6 or more parts, or parts of similar size (horizontal BarChart); negative values (BarChart); change over time (AreaChart).
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per part, sorted descending: a name column and a value column. Pass both keys.
+
+**Gotchas:** a negative value shows an error and an all-zero result the empty state. Zero and missing slices are left out.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/pie/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/pie/index.tsx)
@@ -48,32 +54,38 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
-| `innerRadius` | `number` | | `0` | Inner radius for donut charts (0-100%) |
-| `showLabels` | `boolean` | | `true` | Show labels on slices |
+| `innerRadius` | `number` | | `0 (40 on DonutChart)` | Hole radius in percent of the chart, clamped to 0 to 63 (90% of the outer radius). `0` draws a plain pie, also on DonutChart. |
+| `showLabels` | `boolean` | | `true (false with `defaults="v3"`, where the legend shows name, value and share)` | Show labels on slices. |
| `labelPosition` | `"center" \| "outside" \| "inside"` | | `"outside"` | Label position |
+| `centerLabel` | `string \| boolean` | | `true on a v3 DonutChart` | Text in the donut hole, sized to fit it. `true` shows the formatted total (compacted, e.g. "9.7M", when the full number doesn't fit). Ignored on a pie without a hole. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { PieChart } from '@databricks/appkit-ui';
+import { PieChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/RadarChart.mdx b/docs/docs/api/appkit-ui/data/RadarChart.mdx
index 9bb102b65..62bca1aa8 100644
--- a/docs/docs/api/appkit-ui/data/RadarChart.mdx
+++ b/docs/docs/api/appkit-ui/data/RadarChart.mdx
@@ -6,23 +6,36 @@ Radar Chart component for multi-dimensional data comparison.
## Example
```tsx
-"use client";
-
import { RadarChart } from "@databricks/appkit-ui/react";
+// One row per entity, on one 0-100 scale, as a SQL query returns it.
+// `metrics` names the spokes; `max` fixes the rim at 100.
+// SELECT region, availability, latency_score, error_score, cost_score
+// FROM region_scores
+const rows = [
+ {
+ region: "us-east",
+ availability: 98,
+ latency_score: 82,
+ error_score: 91,
+ cost_score: 64,
+ },
+ {
+ region: "eu-west",
+ availability: 95,
+ latency_score: 88,
+ error_score: 79,
+ cost_score: 72,
+ },
+];
+
export default function RadarChartExample() {
return (
);
@@ -35,11 +48,19 @@ export default function RadarChartExample() {
Radar Chart component for multi-dimensional data comparison.
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** asked to show how one or two entities score on 4 to 8 metrics on one scale.
+
+**Not when:** metrics in different units (DataTable); more than 3 entities (grouped BarChart).
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per entity as SQL returns them, with `metrics` naming the spokes; or one row per metric with a `yKey` per entity.
+
+**Gotchas:** pass `max` when the scale is known (`max={100}` for scores). Negative values show an error.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/radar/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/radar/index.tsx)
@@ -52,30 +73,37 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
| `showArea` | `boolean` | | `true` | Show area fill |
+| `max` | `number \| readonly number[]` | | - | The rim value: one number for every metric (e.g. `100` for scores), or one per metric in row order. Unset: the data's largest value rounded up. |
+| `metrics` | `readonly string[]` | | - | Metric columns, for data with one row per entity (the shape a SQL query returns: `name, speed, power, range`). Each listed column becomes a spoke and each row a polygon named by `xKey` (or the first text column). Without it, rows are metrics and `yKey` columns are the series. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { RadarChart } from '@databricks/appkit-ui';
+import { RadarChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/data/ScatterChart.mdx b/docs/docs/api/appkit-ui/data/ScatterChart.mdx
index 0e395190a..552905490 100644
--- a/docs/docs/api/appkit-ui/data/ScatterChart.mdx
+++ b/docs/docs/api/appkit-ui/data/ScatterChart.mdx
@@ -6,25 +6,28 @@ Scatter Chart component for correlation and distribution visualization.
## Example
```tsx
-"use client";
-
import { ScatterChart } from "@databricks/appkit-ui/react";
+// Two measures per entity, as `config/queries/customer_health.sql` returns them.
+// Pass both keys: a scatter needs a numeric x and y.
+// SELECT customer, CAST(monthly_spend AS DOUBLE) AS monthly_spend, uptime_pct
+// FROM customer_health
+const rows = [
+ { customer: "Acme", monthly_spend: 5200, uptime_pct: 99.1 },
+ { customer: "Globex", monthly_spend: 5850, uptime_pct: 98.4 },
+ { customer: "Initech", monthly_spend: 5400, uptime_pct: 97.2 },
+ { customer: "Umbrella", monthly_spend: 6000, uptime_pct: 99.5 },
+ { customer: "Hooli", monthly_spend: 5050, uptime_pct: 98.9 },
+ { customer: "Stark", monthly_spend: 5600, uptime_pct: 97.8 },
+];
+
export default function ScatterChartExample() {
return (
`${value}%`}
height={300}
/>
);
@@ -37,11 +40,19 @@ export default function ScatterChartExample() {
Scatter Chart component for correlation and distribution visualization.
-**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
+**Use when:** checking whether two measures are related, one point per entity.
+
+**Not when:** under 10 points (DataTable); over 2,000 points (aggregate in SQL first).
-**Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.
+**Rows:** one per entity: two numeric measures and a label column. Pass both `xKey` and `yKey`.
+
+**Gotchas:** a text x shows an error; DATE values on x give a time axis. A point with a missing x or y is left out.
+
+**Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.
-Supports both query mode (queryKey + parameters) and data mode (static data).
+**Data:** pass `queryKey` (and `parameters`) when the chart owns its query. Pass `data={rows}` when several
+elements share one result (a KPI, a chart and a table fed by one `useAnalyticsQuery`), or for stub rows while
+the UI is built first; add `loading` and `error` so the chart shows those states in its box.
**Source:** [`packages/appkit-ui/src/react/charts/scatter/index.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/charts/scatter/index.tsx)
@@ -54,30 +65,37 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
| `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
| `parameters` | `Record` | | - | Query parameters passed to the analytics endpoint |
| `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json_array": Use JSON format (smaller payloads, simpler) - "arrow_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
-| `transformer` | `((data: T) => T)` | | - | Transform raw data before rendering |
+| `transformer` | `ChartTransformer \| LegacyChartTransformer` | | - | Reshape fetched rows before rendering. Arrow results arrive as rows too (DECIMAL scaled, DATE as YYYY-MM-DD, TIMESTAMP as an ISO string). The generic LegacyChartTransformer signature is deprecated; use ChartTransformer. |
| `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
| `title` | `string` | | - | Chart title |
-| `showLegend` | `boolean` | | - | Show legend |
+| `showLegend` | `boolean` | | `true` | Show the legend. Series charts draw it only when there are two or more series; pie and donut always; on a heatmap it is the color scale. |
| `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
-| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
-| `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
+| `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette): hex, `rgb()` or `hsl()` strings, or theme tokens such as `var(--chart-cat-1)`, which are resolved against the root element before drawing (and again on theme change). Without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes). ECharts can't parse `oklch()`, so the variables must hold hex, rgb or hsl values. |
+| `height` | `number` | | - | Chart height in pixels. Without it the chart fills its parent, at least 160 px (300 px with `defaults="v3"`). A className height such as `h-[400px]` also works. |
| `className` | `string` | | - | Additional CSS classes |
| `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
| `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
+| `seriesKey` | `string` | | - | Column that names the series in long rows (one row per x, series and value, as SQL returns them). With it, `yKey` is the single value column and each distinct value of `seriesKey` becomes a series. |
+| `xType` | `"time" \| "value" \| "category"` | | - | X axis type (cartesian charts). Inferred from the `xKey` values only, never from column names: all dates gives `"time"`, otherwise `"category"`. By default, numeric bar values and numeric-looking line, area and scatter values sort ascending. Pass `"category"` to keep their text and row order. |
+| `defaults` | `"v3"` | | - | Opt into the v3 defaults. See ChartDefaults. Bug fixes apply with or without it; only defaults that change the look of a correct chart are gated. |
| `ariaLabel` | `string` | | - | Accessibility label for screen readers |
| `testId` | `string` | | - | Test ID for automated testing |
-| `options` | `Record` | | - | Additional ECharts options to merge |
+| `options` | `Record \| ((built: Record) => Record)` | | - | Additional ECharts options. Objects are shallow-merged by default; with `defaults="v3"` they are deep-merged (`series`, axes and grid by index). A function receives the built option and returns the option to render. |
| `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) => string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
| `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to <canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
| `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
| `symbolSize` | `number` | | `8` | Symbol size |
+| `referenceLines` | `ChartReferenceLine[]` | | - | Target or reference lines across the plot, at values of the value axis (`[{ value: 100, label: "Target" }]`). |
+| `showValues` | `boolean` | | `false` | Print each bar's (or point's) value next to it. |
+| `loading` | `boolean` | | - | Show the loading state instead of the chart, in the chart's box. Use it while the rows are being fetched (`data={rows ?? []} loading={!rows}`). |
+| `error` | `string \| Error \| null` | | - | Show this error instead of the chart, in the chart's box. |
### Usage
```tsx
-import { ScatterChart } from '@databricks/appkit-ui';
+import { ScatterChart } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/files/DirectoryList.mdx b/docs/docs/api/appkit-ui/files/DirectoryList.mdx
index d73e97ca3..46cad416a 100644
--- a/docs/docs/api/appkit-ui/files/DirectoryList.mdx
+++ b/docs/docs/api/appkit-ui/files/DirectoryList.mdx
@@ -34,7 +34,7 @@ Card-wrapped directory listing with loading, error, and empty states
### Usage
```tsx
-import { DirectoryList } from '@databricks/appkit-ui';
+import { DirectoryList } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/files/FileBreadcrumb.mdx b/docs/docs/api/appkit-ui/files/FileBreadcrumb.mdx
index e4b6bf5c5..b0cc17186 100644
--- a/docs/docs/api/appkit-ui/files/FileBreadcrumb.mdx
+++ b/docs/docs/api/appkit-ui/files/FileBreadcrumb.mdx
@@ -25,7 +25,7 @@ Path-aware breadcrumb navigation built on top of Breadcrumb primitives
### Usage
```tsx
-import { FileBreadcrumb } from '@databricks/appkit-ui';
+import { FileBreadcrumb } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/files/FileEntry.mdx b/docs/docs/api/appkit-ui/files/FileEntry.mdx
index 6b8e2ba15..deb640a1d 100644
--- a/docs/docs/api/appkit-ui/files/FileEntry.mdx
+++ b/docs/docs/api/appkit-ui/files/FileEntry.mdx
@@ -25,7 +25,7 @@ Single file or directory row with icon, name, size, and selection state
### Usage
```tsx
-import { FileEntry } from '@databricks/appkit-ui';
+import { FileEntry } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/files/FilePreviewPanel.mdx b/docs/docs/api/appkit-ui/files/FilePreviewPanel.mdx
index 2c594781f..0e453318e 100644
--- a/docs/docs/api/appkit-ui/files/FilePreviewPanel.mdx
+++ b/docs/docs/api/appkit-ui/files/FilePreviewPanel.mdx
@@ -30,7 +30,7 @@ Preview panel displaying file metadata, image/text preview, and download/delete
### Usage
```tsx
-import { FilePreviewPanel } from '@databricks/appkit-ui';
+import { FilePreviewPanel } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/files/NewFolderInput.mdx b/docs/docs/api/appkit-ui/files/NewFolderInput.mdx
index 56768e4a3..59fd688df 100644
--- a/docs/docs/api/appkit-ui/files/NewFolderInput.mdx
+++ b/docs/docs/api/appkit-ui/files/NewFolderInput.mdx
@@ -28,7 +28,7 @@ Inline folder-name input with create/cancel actions
### Usage
```tsx
-import { NewFolderInput } from '@databricks/appkit-ui';
+import { NewFolderInput } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/genie/GenieChat.mdx b/docs/docs/api/appkit-ui/genie/GenieChat.mdx
index 22e76deb6..40adb73d6 100644
--- a/docs/docs/api/appkit-ui/genie/GenieChat.mdx
+++ b/docs/docs/api/appkit-ui/genie/GenieChat.mdx
@@ -41,7 +41,7 @@ Full-featured chat interface for a single Databricks AI/BI Genie space. Handles
### Usage
```tsx
-import { GenieChat } from '@databricks/appkit-ui';
+import { GenieChat } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/genie/GenieChatInput.mdx b/docs/docs/api/appkit-ui/genie/GenieChatInput.mdx
index 79a6e6ab5..1f859d589 100644
--- a/docs/docs/api/appkit-ui/genie/GenieChatInput.mdx
+++ b/docs/docs/api/appkit-ui/genie/GenieChatInput.mdx
@@ -25,7 +25,7 @@ Auto-expanding textarea input with a send button for chat messages. Submits on E
### Usage
```tsx
-import { GenieChatInput } from '@databricks/appkit-ui';
+import { GenieChatInput } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/genie/GenieChatMessage.mdx b/docs/docs/api/appkit-ui/genie/GenieChatMessage.mdx
index 1092051c3..c2dbc541f 100644
--- a/docs/docs/api/appkit-ui/genie/GenieChatMessage.mdx
+++ b/docs/docs/api/appkit-ui/genie/GenieChatMessage.mdx
@@ -23,7 +23,7 @@ Renders a single Genie message bubble with optional expandable SQL query attachm
### Usage
```tsx
-import { GenieChatMessage } from '@databricks/appkit-ui';
+import { GenieChatMessage } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/genie/GenieChatMessageList.mdx b/docs/docs/api/appkit-ui/genie/GenieChatMessageList.mdx
index cb8d6d4b3..99f6742b7 100644
--- a/docs/docs/api/appkit-ui/genie/GenieChatMessageList.mdx
+++ b/docs/docs/api/appkit-ui/genie/GenieChatMessageList.mdx
@@ -26,7 +26,7 @@ Scrollable message list that renders Genie chat messages with auto-scroll, skele
### Usage
```tsx
-import { GenieChatMessageList } from '@databricks/appkit-ui';
+import { GenieChatMessageList } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/genie/GenieQueryVisualization.mdx b/docs/docs/api/appkit-ui/genie/GenieQueryVisualization.mdx
index 44dd3cd33..6e6a82cb5 100644
--- a/docs/docs/api/appkit-ui/genie/GenieQueryVisualization.mdx
+++ b/docs/docs/api/appkit-ui/genie/GenieQueryVisualization.mdx
@@ -30,7 +30,7 @@ Renders a chart + data table for a Genie query result.
### Usage
```tsx
-import { GenieQueryVisualization } from '@databricks/appkit-ui';
+import { GenieQueryVisualization } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Accordion.mdx b/docs/docs/api/appkit-ui/ui/Accordion.mdx
index 91620c343..f00d0ae14 100644
--- a/docs/docs/api/appkit-ui/ui/Accordion.mdx
+++ b/docs/docs/api/appkit-ui/ui/Accordion.mdx
@@ -37,7 +37,7 @@ Collapsible content sections organized in a vertical stack
### Usage
```tsx
-import { Accordion } from '@databricks/appkit-ui';
+import { Accordion } from '@databricks/appkit-ui/react';
```
@@ -63,7 +63,7 @@ Content area that expands and collapses within an accordion item
### Usage
```tsx
-import { AccordionContent } from '@databricks/appkit-ui';
+import { AccordionContent } from '@databricks/appkit-ui/react';
```
@@ -90,7 +90,7 @@ Individual collapsible section within an accordion
### Usage
```tsx
-import { AccordionItem } from '@databricks/appkit-ui';
+import { AccordionItem } from '@databricks/appkit-ui/react';
```
@@ -115,7 +115,7 @@ Clickable button that triggers accordion content visibility
### Usage
```tsx
-import { AccordionTrigger } from '@databricks/appkit-ui';
+import { AccordionTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Alert.mdx b/docs/docs/api/appkit-ui/ui/Alert.mdx
index 01772655f..620ed3362 100644
--- a/docs/docs/api/appkit-ui/ui/Alert.mdx
+++ b/docs/docs/api/appkit-ui/ui/Alert.mdx
@@ -29,7 +29,7 @@ Displays important information with optional icon and multiple variants
### Usage
```tsx
-import { Alert } from '@databricks/appkit-ui';
+import { Alert } from '@databricks/appkit-ui/react';
```
@@ -52,7 +52,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { AlertDescription } from '@databricks/appkit-ui';
+import { AlertDescription } from '@databricks/appkit-ui/react';
```
@@ -75,7 +75,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { AlertTitle } from '@databricks/appkit-ui';
+import { AlertTitle } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/AlertDialog.mdx b/docs/docs/api/appkit-ui/ui/AlertDialog.mdx
index 79f54905d..148b220bc 100644
--- a/docs/docs/api/appkit-ui/ui/AlertDialog.mdx
+++ b/docs/docs/api/appkit-ui/ui/AlertDialog.mdx
@@ -31,7 +31,7 @@ Modal dialog that interrupts the user with critical information requiring immedi
### Usage
```tsx
-import { AlertDialog } from '@databricks/appkit-ui';
+import { AlertDialog } from '@databricks/appkit-ui/react';
```
@@ -56,7 +56,7 @@ Primary action button that confirms the alert
### Usage
```tsx
-import { AlertDialogAction } from '@databricks/appkit-ui';
+import { AlertDialogAction } from '@databricks/appkit-ui/react';
```
@@ -81,7 +81,7 @@ Cancel button that dismisses the alert dialog
### Usage
```tsx
-import { AlertDialogCancel } from '@databricks/appkit-ui';
+import { AlertDialogCancel } from '@databricks/appkit-ui/react';
```
@@ -111,7 +111,7 @@ Main content container for the alert dialog
### Usage
```tsx
-import { AlertDialogContent } from '@databricks/appkit-ui';
+import { AlertDialogContent } from '@databricks/appkit-ui/react';
```
@@ -136,7 +136,7 @@ Descriptive text explaining the alert
### Usage
```tsx
-import { AlertDialogDescription } from '@databricks/appkit-ui';
+import { AlertDialogDescription } from '@databricks/appkit-ui/react';
```
@@ -159,7 +159,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { AlertDialogFooter } from '@databricks/appkit-ui';
+import { AlertDialogFooter } from '@databricks/appkit-ui/react';
```
@@ -182,7 +182,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { AlertDialogHeader } from '@databricks/appkit-ui';
+import { AlertDialogHeader } from '@databricks/appkit-ui/react';
```
@@ -208,7 +208,7 @@ Background overlay that dims content behind the alert dialog
### Usage
```tsx
-import { AlertDialogOverlay } from '@databricks/appkit-ui';
+import { AlertDialogOverlay } from '@databricks/appkit-ui/react';
```
@@ -234,7 +234,7 @@ Portal container for rendering alert dialog content outside the DOM hierarchy
### Usage
```tsx
-import { AlertDialogPortal } from '@databricks/appkit-ui';
+import { AlertDialogPortal } from '@databricks/appkit-ui/react';
```
@@ -259,7 +259,7 @@ Title heading for the alert dialog
### Usage
```tsx
-import { AlertDialogTitle } from '@databricks/appkit-ui';
+import { AlertDialogTitle } from '@databricks/appkit-ui/react';
```
@@ -284,7 +284,7 @@ Button that triggers the alert dialog to open
### Usage
```tsx
-import { AlertDialogTrigger } from '@databricks/appkit-ui';
+import { AlertDialogTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/AspectRatio.mdx b/docs/docs/api/appkit-ui/ui/AspectRatio.mdx
index f601d239d..ee9197872 100644
--- a/docs/docs/api/appkit-ui/ui/AspectRatio.mdx
+++ b/docs/docs/api/appkit-ui/ui/AspectRatio.mdx
@@ -30,7 +30,7 @@ Container that maintains a specific aspect ratio for its content
### Usage
```tsx
-import { AspectRatio } from '@databricks/appkit-ui';
+import { AspectRatio } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Avatar.mdx b/docs/docs/api/appkit-ui/ui/Avatar.mdx
index 656858b26..4aabccc8c 100644
--- a/docs/docs/api/appkit-ui/ui/Avatar.mdx
+++ b/docs/docs/api/appkit-ui/ui/Avatar.mdx
@@ -29,7 +29,7 @@ Displays user profile picture or initials in a circular container
### Usage
```tsx
-import { Avatar } from '@databricks/appkit-ui';
+import { Avatar } from '@databricks/appkit-ui/react';
```
@@ -55,7 +55,7 @@ Fallback content displayed when avatar image fails to load
### Usage
```tsx
-import { AvatarFallback } from '@databricks/appkit-ui';
+import { AvatarFallback } from '@databricks/appkit-ui/react';
```
@@ -81,7 +81,7 @@ Image element for the avatar
### Usage
```tsx
-import { AvatarImage } from '@databricks/appkit-ui';
+import { AvatarImage } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Badge.mdx b/docs/docs/api/appkit-ui/ui/Badge.mdx
index ce2862fcd..37b52c339 100644
--- a/docs/docs/api/appkit-ui/ui/Badge.mdx
+++ b/docs/docs/api/appkit-ui/ui/Badge.mdx
@@ -30,7 +30,7 @@ Small label for displaying status, categories, or counts
### Usage
```tsx
-import { Badge } from '@databricks/appkit-ui';
+import { Badge } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Breadcrumb.mdx b/docs/docs/api/appkit-ui/ui/Breadcrumb.mdx
index c480562cb..6c0b19375 100644
--- a/docs/docs/api/appkit-ui/ui/Breadcrumb.mdx
+++ b/docs/docs/api/appkit-ui/ui/Breadcrumb.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Breadcrumb } from '@databricks/appkit-ui';
+import { Breadcrumb } from '@databricks/appkit-ui/react';
```
@@ -50,7 +50,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { BreadcrumbEllipsis } from '@databricks/appkit-ui';
+import { BreadcrumbEllipsis } from '@databricks/appkit-ui/react';
```
@@ -73,7 +73,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { BreadcrumbItem } from '@databricks/appkit-ui';
+import { BreadcrumbItem } from '@databricks/appkit-ui/react';
```
@@ -98,7 +98,7 @@ Clickable link within a breadcrumb item
### Usage
```tsx
-import { BreadcrumbLink } from '@databricks/appkit-ui';
+import { BreadcrumbLink } from '@databricks/appkit-ui/react';
```
@@ -121,7 +121,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { BreadcrumbList } from '@databricks/appkit-ui';
+import { BreadcrumbList } from '@databricks/appkit-ui/react';
```
@@ -144,7 +144,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { BreadcrumbPage } from '@databricks/appkit-ui';
+import { BreadcrumbPage } from '@databricks/appkit-ui/react';
```
@@ -167,7 +167,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { BreadcrumbSeparator } from '@databricks/appkit-ui';
+import { BreadcrumbSeparator } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Button.mdx b/docs/docs/api/appkit-ui/ui/Button.mdx
index 46835d345..0c47b4542 100644
--- a/docs/docs/api/appkit-ui/ui/Button.mdx
+++ b/docs/docs/api/appkit-ui/ui/Button.mdx
@@ -31,7 +31,7 @@ Clickable button with multiple variants and sizes
### Usage
```tsx
-import { Button } from '@databricks/appkit-ui';
+import { Button } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/ButtonGroup.mdx b/docs/docs/api/appkit-ui/ui/ButtonGroup.mdx
index bd518a5b7..165beceed 100644
--- a/docs/docs/api/appkit-ui/ui/ButtonGroup.mdx
+++ b/docs/docs/api/appkit-ui/ui/ButtonGroup.mdx
@@ -22,7 +22,7 @@ Container for grouping related buttons together with shared borders
### Usage
```tsx
-import { ButtonGroup } from '@databricks/appkit-ui';
+import { ButtonGroup } from '@databricks/appkit-ui/react';
```
@@ -49,7 +49,7 @@ Visual separator between buttons in a button group
### Usage
```tsx
-import { ButtonGroupSeparator } from '@databricks/appkit-ui';
+import { ButtonGroupSeparator } from '@databricks/appkit-ui/react';
```
@@ -74,7 +74,7 @@ Text label or content within a button group
### Usage
```tsx
-import { ButtonGroupText } from '@databricks/appkit-ui';
+import { ButtonGroupText } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Calendar.mdx b/docs/docs/api/appkit-ui/ui/Calendar.mdx
index 936180afe..ab428acbf 100644
--- a/docs/docs/api/appkit-ui/ui/Calendar.mdx
+++ b/docs/docs/api/appkit-ui/ui/Calendar.mdx
@@ -111,7 +111,7 @@ Date picker component for selecting single dates or date ranges
### Usage
```tsx
-import { Calendar } from '@databricks/appkit-ui';
+import { Calendar } from '@databricks/appkit-ui/react';
```
@@ -137,7 +137,7 @@ Individual day button within the calendar grid
### Usage
```tsx
-import { CalendarDayButton } from '@databricks/appkit-ui';
+import { CalendarDayButton } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Card.mdx b/docs/docs/api/appkit-ui/ui/Card.mdx
index c1c01e23a..1abf334b9 100644
--- a/docs/docs/api/appkit-ui/ui/Card.mdx
+++ b/docs/docs/api/appkit-ui/ui/Card.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Card } from '@databricks/appkit-ui';
+import { Card } from '@databricks/appkit-ui/react';
```
@@ -50,7 +50,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CardAction } from '@databricks/appkit-ui';
+import { CardAction } from '@databricks/appkit-ui/react';
```
@@ -73,7 +73,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CardContent } from '@databricks/appkit-ui';
+import { CardContent } from '@databricks/appkit-ui/react';
```
@@ -96,7 +96,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CardDescription } from '@databricks/appkit-ui';
+import { CardDescription } from '@databricks/appkit-ui/react';
```
@@ -119,7 +119,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CardFooter } from '@databricks/appkit-ui';
+import { CardFooter } from '@databricks/appkit-ui/react';
```
@@ -142,7 +142,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CardHeader } from '@databricks/appkit-ui';
+import { CardHeader } from '@databricks/appkit-ui/react';
```
@@ -165,7 +165,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CardTitle } from '@databricks/appkit-ui';
+import { CardTitle } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Carousel.mdx b/docs/docs/api/appkit-ui/ui/Carousel.mdx
index d54d884a8..b278fcf47 100644
--- a/docs/docs/api/appkit-ui/ui/Carousel.mdx
+++ b/docs/docs/api/appkit-ui/ui/Carousel.mdx
@@ -32,7 +32,7 @@ Slideshow component for cycling through content with navigation controls
### Usage
```tsx
-import { Carousel } from '@databricks/appkit-ui';
+import { Carousel } from '@databricks/appkit-ui/react';
```
@@ -55,7 +55,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CarouselContent } from '@databricks/appkit-ui';
+import { CarouselContent } from '@databricks/appkit-ui/react';
```
@@ -78,7 +78,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CarouselItem } from '@databricks/appkit-ui';
+import { CarouselItem } from '@databricks/appkit-ui/react';
```
@@ -105,7 +105,7 @@ Button to navigate to the next carousel slide
### Usage
```tsx
-import { CarouselNext } from '@databricks/appkit-ui';
+import { CarouselNext } from '@databricks/appkit-ui/react';
```
@@ -132,7 +132,7 @@ Button to navigate to the previous carousel slide
### Usage
```tsx
-import { CarouselPrevious } from '@databricks/appkit-ui';
+import { CarouselPrevious } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Checkbox.mdx b/docs/docs/api/appkit-ui/ui/Checkbox.mdx
index 63af8ac1f..f23125373 100644
--- a/docs/docs/api/appkit-ui/ui/Checkbox.mdx
+++ b/docs/docs/api/appkit-ui/ui/Checkbox.mdx
@@ -33,7 +33,7 @@ Checkbox input for selecting multiple options
### Usage
```tsx
-import { Checkbox } from '@databricks/appkit-ui';
+import { Checkbox } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Collapsible.mdx b/docs/docs/api/appkit-ui/ui/Collapsible.mdx
index 4af5130d6..4763e7d1b 100644
--- a/docs/docs/api/appkit-ui/ui/Collapsible.mdx
+++ b/docs/docs/api/appkit-ui/ui/Collapsible.mdx
@@ -33,7 +33,7 @@ Interactive component that expands and collapses content
### Usage
```tsx
-import { Collapsible } from '@databricks/appkit-ui';
+import { Collapsible } from '@databricks/appkit-ui/react';
```
@@ -59,7 +59,7 @@ Content area that can be expanded or collapsed
### Usage
```tsx
-import { CollapsibleContent } from '@databricks/appkit-ui';
+import { CollapsibleContent } from '@databricks/appkit-ui/react';
```
@@ -84,7 +84,7 @@ Button that toggles the collapsible content visibility
### Usage
```tsx
-import { CollapsibleTrigger } from '@databricks/appkit-ui';
+import { CollapsibleTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Command.mdx b/docs/docs/api/appkit-ui/ui/Command.mdx
index b882d5cfb..9ee0709d1 100644
--- a/docs/docs/api/appkit-ui/ui/Command.mdx
+++ b/docs/docs/api/appkit-ui/ui/Command.mdx
@@ -37,7 +37,7 @@ Command palette for keyboard-driven navigation and actions
### Usage
```tsx
-import { Command } from '@databricks/appkit-ui';
+import { Command } from '@databricks/appkit-ui/react';
```
@@ -69,7 +69,7 @@ Dialog wrapper for the command palette
### Usage
```tsx
-import { CommandDialog } from '@databricks/appkit-ui';
+import { CommandDialog } from '@databricks/appkit-ui/react';
```
@@ -94,7 +94,7 @@ Empty state displayed when no commands match the search
### Usage
```tsx
-import { CommandEmpty } from '@databricks/appkit-ui';
+import { CommandEmpty } from '@databricks/appkit-ui/react';
```
@@ -122,7 +122,7 @@ Group of related command items with an optional heading
### Usage
```tsx
-import { CommandGroup } from '@databricks/appkit-ui';
+import { CommandGroup } from '@databricks/appkit-ui/react';
```
@@ -149,7 +149,7 @@ Search input field for filtering command items
### Usage
```tsx
-import { CommandInput } from '@databricks/appkit-ui';
+import { CommandInput } from '@databricks/appkit-ui/react';
```
@@ -179,7 +179,7 @@ Individual selectable command item
### Usage
```tsx
-import { CommandItem } from '@databricks/appkit-ui';
+import { CommandItem } from '@databricks/appkit-ui/react';
```
@@ -205,7 +205,7 @@ Scrollable list container for command items
### Usage
```tsx
-import { CommandList } from '@databricks/appkit-ui';
+import { CommandList } from '@databricks/appkit-ui/react';
```
@@ -231,7 +231,7 @@ Visual separator between command groups
### Usage
```tsx
-import { CommandSeparator } from '@databricks/appkit-ui';
+import { CommandSeparator } from '@databricks/appkit-ui/react';
```
@@ -254,7 +254,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { CommandShortcut } from '@databricks/appkit-ui';
+import { CommandShortcut } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/ContextMenu.mdx b/docs/docs/api/appkit-ui/ui/ContextMenu.mdx
index dbdd45ba8..a4ba43eae 100644
--- a/docs/docs/api/appkit-ui/ui/ContextMenu.mdx
+++ b/docs/docs/api/appkit-ui/ui/ContextMenu.mdx
@@ -31,7 +31,7 @@ Menu triggered by right-clicking an element
### Usage
```tsx
-import { ContextMenu } from '@databricks/appkit-ui';
+import { ContextMenu } from '@databricks/appkit-ui/react';
```
@@ -59,7 +59,7 @@ import { ContextMenu } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuCheckboxItem } from '@databricks/appkit-ui';
+import { ContextMenuCheckboxItem } from '@databricks/appkit-ui/react';
```
@@ -97,7 +97,7 @@ import { ContextMenuCheckboxItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuContent } from '@databricks/appkit-ui';
+import { ContextMenuContent } from '@databricks/appkit-ui/react';
```
@@ -120,7 +120,7 @@ import { ContextMenuContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuGroup } from '@databricks/appkit-ui';
+import { ContextMenuGroup } from '@databricks/appkit-ui/react';
```
@@ -148,7 +148,7 @@ import { ContextMenuGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuItem } from '@databricks/appkit-ui';
+import { ContextMenuItem } from '@databricks/appkit-ui/react';
```
@@ -172,7 +172,7 @@ import { ContextMenuItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuLabel } from '@databricks/appkit-ui';
+import { ContextMenuLabel } from '@databricks/appkit-ui/react';
```
@@ -196,7 +196,7 @@ import { ContextMenuLabel } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuPortal } from '@databricks/appkit-ui';
+import { ContextMenuPortal } from '@databricks/appkit-ui/react';
```
@@ -221,7 +221,7 @@ import { ContextMenuPortal } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuRadioGroup } from '@databricks/appkit-ui';
+import { ContextMenuRadioGroup } from '@databricks/appkit-ui/react';
```
@@ -248,7 +248,7 @@ import { ContextMenuRadioGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuRadioItem } from '@databricks/appkit-ui';
+import { ContextMenuRadioItem } from '@databricks/appkit-ui/react';
```
@@ -271,7 +271,7 @@ import { ContextMenuRadioItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuSeparator } from '@databricks/appkit-ui';
+import { ContextMenuSeparator } from '@databricks/appkit-ui/react';
```
@@ -292,7 +292,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ContextMenuShortcut } from '@databricks/appkit-ui';
+import { ContextMenuShortcut } from '@databricks/appkit-ui/react';
```
@@ -317,7 +317,7 @@ import { ContextMenuShortcut } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuSub } from '@databricks/appkit-ui';
+import { ContextMenuSub } from '@databricks/appkit-ui/react';
```
@@ -355,7 +355,7 @@ import { ContextMenuSub } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuSubContent } from '@databricks/appkit-ui';
+import { ContextMenuSubContent } from '@databricks/appkit-ui/react';
```
@@ -381,7 +381,7 @@ import { ContextMenuSubContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuSubTrigger } from '@databricks/appkit-ui';
+import { ContextMenuSubTrigger } from '@databricks/appkit-ui/react';
```
@@ -405,7 +405,7 @@ import { ContextMenuSubTrigger } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ContextMenuTrigger } from '@databricks/appkit-ui';
+import { ContextMenuTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Dialog.mdx b/docs/docs/api/appkit-ui/ui/Dialog.mdx
index 7e226b205..5a2d9a392 100644
--- a/docs/docs/api/appkit-ui/ui/Dialog.mdx
+++ b/docs/docs/api/appkit-ui/ui/Dialog.mdx
@@ -32,7 +32,7 @@ Modal dialog that overlays the page content
### Usage
```tsx
-import { Dialog } from '@databricks/appkit-ui';
+import { Dialog } from '@databricks/appkit-ui/react';
```
@@ -57,7 +57,7 @@ Button that closes the dialog
### Usage
```tsx
-import { DialogClose } from '@databricks/appkit-ui';
+import { DialogClose } from '@databricks/appkit-ui/react';
```
@@ -90,7 +90,7 @@ Main content area of the dialog
### Usage
```tsx
-import { DialogContent } from '@databricks/appkit-ui';
+import { DialogContent } from '@databricks/appkit-ui/react';
```
@@ -115,7 +115,7 @@ Description text for the dialog
### Usage
```tsx
-import { DialogDescription } from '@databricks/appkit-ui';
+import { DialogDescription } from '@databricks/appkit-ui/react';
```
@@ -138,7 +138,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { DialogFooter } from '@databricks/appkit-ui';
+import { DialogFooter } from '@databricks/appkit-ui/react';
```
@@ -161,7 +161,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { DialogHeader } from '@databricks/appkit-ui';
+import { DialogHeader } from '@databricks/appkit-ui/react';
```
@@ -187,7 +187,7 @@ Dimmed overlay behind the dialog
### Usage
```tsx
-import { DialogOverlay } from '@databricks/appkit-ui';
+import { DialogOverlay } from '@databricks/appkit-ui/react';
```
@@ -213,7 +213,7 @@ Portal container for dialog content
### Usage
```tsx
-import { DialogPortal } from '@databricks/appkit-ui';
+import { DialogPortal } from '@databricks/appkit-ui/react';
```
@@ -238,7 +238,7 @@ Title text for the dialog
### Usage
```tsx
-import { DialogTitle } from '@databricks/appkit-ui';
+import { DialogTitle } from '@databricks/appkit-ui/react';
```
@@ -263,7 +263,7 @@ Button that opens the dialog
### Usage
```tsx
-import { DialogTrigger } from '@databricks/appkit-ui';
+import { DialogTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Drawer.mdx b/docs/docs/api/appkit-ui/ui/Drawer.mdx
index 5094a250d..65e62eca1 100644
--- a/docs/docs/api/appkit-ui/ui/Drawer.mdx
+++ b/docs/docs/api/appkit-ui/ui/Drawer.mdx
@@ -56,7 +56,7 @@ Draggable panel that slides in from screen edges
### Usage
```tsx
-import { Drawer } from '@databricks/appkit-ui';
+import { Drawer } from '@databricks/appkit-ui/react';
```
@@ -81,7 +81,7 @@ Button that closes the drawer
### Usage
```tsx
-import { DrawerClose } from '@databricks/appkit-ui';
+import { DrawerClose } from '@databricks/appkit-ui/react';
```
@@ -113,7 +113,7 @@ Main content area of the drawer
### Usage
```tsx
-import { DrawerContent } from '@databricks/appkit-ui';
+import { DrawerContent } from '@databricks/appkit-ui/react';
```
@@ -138,7 +138,7 @@ Description text for the drawer
### Usage
```tsx
-import { DrawerDescription } from '@databricks/appkit-ui';
+import { DrawerDescription } from '@databricks/appkit-ui/react';
```
@@ -161,7 +161,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { DrawerFooter } from '@databricks/appkit-ui';
+import { DrawerFooter } from '@databricks/appkit-ui/react';
```
@@ -184,7 +184,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { DrawerHeader } from '@databricks/appkit-ui';
+import { DrawerHeader } from '@databricks/appkit-ui/react';
```
@@ -210,7 +210,7 @@ Dimmed overlay behind the drawer
### Usage
```tsx
-import { DrawerOverlay } from '@databricks/appkit-ui';
+import { DrawerOverlay } from '@databricks/appkit-ui/react';
```
@@ -236,7 +236,7 @@ Portal container for drawer content
### Usage
```tsx
-import { DrawerPortal } from '@databricks/appkit-ui';
+import { DrawerPortal } from '@databricks/appkit-ui/react';
```
@@ -261,7 +261,7 @@ Title text for the drawer
### Usage
```tsx
-import { DrawerTitle } from '@databricks/appkit-ui';
+import { DrawerTitle } from '@databricks/appkit-ui/react';
```
@@ -286,7 +286,7 @@ Button that opens the drawer
### Usage
```tsx
-import { DrawerTrigger } from '@databricks/appkit-ui';
+import { DrawerTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/DropdownMenu.mdx b/docs/docs/api/appkit-ui/ui/DropdownMenu.mdx
index 85f57e5f6..1718e0555 100644
--- a/docs/docs/api/appkit-ui/ui/DropdownMenu.mdx
+++ b/docs/docs/api/appkit-ui/ui/DropdownMenu.mdx
@@ -33,7 +33,7 @@ Menu that displays when triggered by a button or element
### Usage
```tsx
-import { DropdownMenu } from '@databricks/appkit-ui';
+import { DropdownMenu } from '@databricks/appkit-ui/react';
```
@@ -61,7 +61,7 @@ import { DropdownMenu } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuCheckboxItem } from '@databricks/appkit-ui';
+import { DropdownMenuCheckboxItem } from '@databricks/appkit-ui/react';
```
@@ -102,7 +102,7 @@ import { DropdownMenuCheckboxItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuContent } from '@databricks/appkit-ui';
+import { DropdownMenuContent } from '@databricks/appkit-ui/react';
```
@@ -125,7 +125,7 @@ import { DropdownMenuContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuGroup } from '@databricks/appkit-ui';
+import { DropdownMenuGroup } from '@databricks/appkit-ui/react';
```
@@ -153,7 +153,7 @@ import { DropdownMenuGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuItem } from '@databricks/appkit-ui';
+import { DropdownMenuItem } from '@databricks/appkit-ui/react';
```
@@ -177,7 +177,7 @@ import { DropdownMenuItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuLabel } from '@databricks/appkit-ui';
+import { DropdownMenuLabel } from '@databricks/appkit-ui/react';
```
@@ -201,7 +201,7 @@ import { DropdownMenuLabel } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuPortal } from '@databricks/appkit-ui';
+import { DropdownMenuPortal } from '@databricks/appkit-ui/react';
```
@@ -226,7 +226,7 @@ import { DropdownMenuPortal } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuRadioGroup } from '@databricks/appkit-ui';
+import { DropdownMenuRadioGroup } from '@databricks/appkit-ui/react';
```
@@ -253,7 +253,7 @@ import { DropdownMenuRadioGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuRadioItem } from '@databricks/appkit-ui';
+import { DropdownMenuRadioItem } from '@databricks/appkit-ui/react';
```
@@ -276,7 +276,7 @@ import { DropdownMenuRadioItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuSeparator } from '@databricks/appkit-ui';
+import { DropdownMenuSeparator } from '@databricks/appkit-ui/react';
```
@@ -297,7 +297,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { DropdownMenuShortcut } from '@databricks/appkit-ui';
+import { DropdownMenuShortcut } from '@databricks/appkit-ui/react';
```
@@ -322,7 +322,7 @@ import { DropdownMenuShortcut } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuSub } from '@databricks/appkit-ui';
+import { DropdownMenuSub } from '@databricks/appkit-ui/react';
```
@@ -360,7 +360,7 @@ import { DropdownMenuSub } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuSubContent } from '@databricks/appkit-ui';
+import { DropdownMenuSubContent } from '@databricks/appkit-ui/react';
```
@@ -386,7 +386,7 @@ import { DropdownMenuSubContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuSubTrigger } from '@databricks/appkit-ui';
+import { DropdownMenuSubTrigger } from '@databricks/appkit-ui/react';
```
@@ -409,7 +409,7 @@ import { DropdownMenuSubTrigger } from '@databricks/appkit-ui';
### Usage
```tsx
-import { DropdownMenuTrigger } from '@databricks/appkit-ui';
+import { DropdownMenuTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Empty.mdx b/docs/docs/api/appkit-ui/ui/Empty.mdx
index 565d21359..016e02016 100644
--- a/docs/docs/api/appkit-ui/ui/Empty.mdx
+++ b/docs/docs/api/appkit-ui/ui/Empty.mdx
@@ -20,7 +20,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Empty } from '@databricks/appkit-ui';
+import { Empty } from '@databricks/appkit-ui/react';
```
@@ -41,7 +41,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { EmptyContent } from '@databricks/appkit-ui';
+import { EmptyContent } from '@databricks/appkit-ui/react';
```
@@ -62,7 +62,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { EmptyDescription } from '@databricks/appkit-ui';
+import { EmptyDescription } from '@databricks/appkit-ui/react';
```
@@ -83,7 +83,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { EmptyHeader } from '@databricks/appkit-ui';
+import { EmptyHeader } from '@databricks/appkit-ui/react';
```
@@ -106,7 +106,7 @@ import { EmptyHeader } from '@databricks/appkit-ui';
### Usage
```tsx
-import { EmptyMedia } from '@databricks/appkit-ui';
+import { EmptyMedia } from '@databricks/appkit-ui/react';
```
@@ -127,7 +127,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { EmptyTitle } from '@databricks/appkit-ui';
+import { EmptyTitle } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Field.mdx b/docs/docs/api/appkit-ui/ui/Field.mdx
index d021a0001..401f8388a 100644
--- a/docs/docs/api/appkit-ui/ui/Field.mdx
+++ b/docs/docs/api/appkit-ui/ui/Field.mdx
@@ -22,7 +22,7 @@ Form field wrapper with label and input positioning
### Usage
```tsx
-import { Field } from '@databricks/appkit-ui';
+import { Field } from '@databricks/appkit-ui/react';
```
@@ -45,7 +45,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FieldContent } from '@databricks/appkit-ui';
+import { FieldContent } from '@databricks/appkit-ui/react';
```
@@ -68,7 +68,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FieldDescription } from '@databricks/appkit-ui';
+import { FieldDescription } from '@databricks/appkit-ui/react';
```
@@ -93,7 +93,7 @@ Error message display for invalid field values
### Usage
```tsx
-import { FieldError } from '@databricks/appkit-ui';
+import { FieldError } from '@databricks/appkit-ui/react';
```
@@ -116,7 +116,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FieldGroup } from '@databricks/appkit-ui';
+import { FieldGroup } from '@databricks/appkit-ui/react';
```
@@ -141,7 +141,7 @@ Label for a form field
### Usage
```tsx
-import { FieldLabel } from '@databricks/appkit-ui';
+import { FieldLabel } from '@databricks/appkit-ui/react';
```
@@ -166,7 +166,7 @@ Title or caption for a fieldset
### Usage
```tsx
-import { FieldLegend } from '@databricks/appkit-ui';
+import { FieldLegend } from '@databricks/appkit-ui/react';
```
@@ -189,7 +189,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FieldSeparator } from '@databricks/appkit-ui';
+import { FieldSeparator } from '@databricks/appkit-ui/react';
```
@@ -212,7 +212,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FieldSet } from '@databricks/appkit-ui';
+import { FieldSet } from '@databricks/appkit-ui/react';
```
@@ -235,7 +235,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FieldTitle } from '@databricks/appkit-ui';
+import { FieldTitle } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/FormControl.mdx b/docs/docs/api/appkit-ui/ui/FormControl.mdx
index 3176b9242..f2c516a54 100644
--- a/docs/docs/api/appkit-ui/ui/FormControl.mdx
+++ b/docs/docs/api/appkit-ui/ui/FormControl.mdx
@@ -20,7 +20,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FormControl } from '@databricks/appkit-ui';
+import { FormControl } from '@databricks/appkit-ui/react';
```
@@ -43,7 +43,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FormDescription } from '@databricks/appkit-ui';
+import { FormDescription } from '@databricks/appkit-ui/react';
```
@@ -75,7 +75,7 @@ Controlled field component for react-hook-form integration
### Usage
```tsx
-import { FormField } from '@databricks/appkit-ui';
+import { FormField } from '@databricks/appkit-ui/react';
```
@@ -98,7 +98,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FormItem } from '@databricks/appkit-ui';
+import { FormItem } from '@databricks/appkit-ui/react';
```
@@ -123,7 +123,7 @@ Label for a form field with error state styling
### Usage
```tsx
-import { FormLabel } from '@databricks/appkit-ui';
+import { FormLabel } from '@databricks/appkit-ui/react';
```
@@ -146,7 +146,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { FormMessage } from '@databricks/appkit-ui';
+import { FormMessage } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/HoverCard.mdx b/docs/docs/api/appkit-ui/ui/HoverCard.mdx
index ee8a37ac9..d4e211711 100644
--- a/docs/docs/api/appkit-ui/ui/HoverCard.mdx
+++ b/docs/docs/api/appkit-ui/ui/HoverCard.mdx
@@ -33,7 +33,7 @@ Content card that appears when hovering over an element
### Usage
```tsx
-import { HoverCard } from '@databricks/appkit-ui';
+import { HoverCard } from '@databricks/appkit-ui/react';
```
@@ -72,7 +72,7 @@ import { HoverCard } from '@databricks/appkit-ui';
### Usage
```tsx
-import { HoverCardContent } from '@databricks/appkit-ui';
+import { HoverCardContent } from '@databricks/appkit-ui/react';
```
@@ -95,7 +95,7 @@ import { HoverCardContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { HoverCardTrigger } from '@databricks/appkit-ui';
+import { HoverCardTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Input.mdx b/docs/docs/api/appkit-ui/ui/Input.mdx
index 41c3a0188..08ef10130 100644
--- a/docs/docs/api/appkit-ui/ui/Input.mdx
+++ b/docs/docs/api/appkit-ui/ui/Input.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Input } from '@databricks/appkit-ui';
+import { Input } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/InputGroup.mdx b/docs/docs/api/appkit-ui/ui/InputGroup.mdx
index c218f2cad..3058f5f98 100644
--- a/docs/docs/api/appkit-ui/ui/InputGroup.mdx
+++ b/docs/docs/api/appkit-ui/ui/InputGroup.mdx
@@ -20,7 +20,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { InputGroup } from '@databricks/appkit-ui';
+import { InputGroup } from '@databricks/appkit-ui/react';
```
@@ -45,7 +45,7 @@ Decorative content positioned at the start or end of an input group
### Usage
```tsx
-import { InputGroupAddon } from '@databricks/appkit-ui';
+import { InputGroupAddon } from '@databricks/appkit-ui/react';
```
@@ -72,7 +72,7 @@ Button integrated within an input group
### Usage
```tsx
-import { InputGroupButton } from '@databricks/appkit-ui';
+import { InputGroupButton } from '@databricks/appkit-ui/react';
```
@@ -95,7 +95,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { InputGroupInput } from '@databricks/appkit-ui';
+import { InputGroupInput } from '@databricks/appkit-ui/react';
```
@@ -118,7 +118,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { InputGroupText } from '@databricks/appkit-ui';
+import { InputGroupText } from '@databricks/appkit-ui/react';
```
@@ -141,7 +141,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { InputGroupTextarea } from '@databricks/appkit-ui';
+import { InputGroupTextarea } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/InputOTP.mdx b/docs/docs/api/appkit-ui/ui/InputOTP.mdx
index d90ccd899..b403e5c8a 100644
--- a/docs/docs/api/appkit-ui/ui/InputOTP.mdx
+++ b/docs/docs/api/appkit-ui/ui/InputOTP.mdx
@@ -38,7 +38,7 @@ One-time password input with individual character slots
### Usage
```tsx
-import { InputOTP } from '@databricks/appkit-ui';
+import { InputOTP } from '@databricks/appkit-ui/react';
```
@@ -61,7 +61,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { InputOTPGroup } from '@databricks/appkit-ui';
+import { InputOTPGroup } from '@databricks/appkit-ui/react';
```
@@ -84,7 +84,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { InputOTPSeparator } from '@databricks/appkit-ui';
+import { InputOTPSeparator } from '@databricks/appkit-ui/react';
```
@@ -109,7 +109,7 @@ Individual character slot within the OTP input
### Usage
```tsx
-import { InputOTPSlot } from '@databricks/appkit-ui';
+import { InputOTPSlot } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Item.mdx b/docs/docs/api/appkit-ui/ui/Item.mdx
index 4ed3933ea..3cfdfa310 100644
--- a/docs/docs/api/appkit-ui/ui/Item.mdx
+++ b/docs/docs/api/appkit-ui/ui/Item.mdx
@@ -24,7 +24,7 @@ Flexible container for list items with media, content, and actions
### Usage
```tsx
-import { Item } from '@databricks/appkit-ui';
+import { Item } from '@databricks/appkit-ui/react';
```
@@ -45,7 +45,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemActions } from '@databricks/appkit-ui';
+import { ItemActions } from '@databricks/appkit-ui/react';
```
@@ -66,7 +66,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemContent } from '@databricks/appkit-ui';
+import { ItemContent } from '@databricks/appkit-ui/react';
```
@@ -87,7 +87,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemDescription } from '@databricks/appkit-ui';
+import { ItemDescription } from '@databricks/appkit-ui/react';
```
@@ -108,7 +108,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemFooter } from '@databricks/appkit-ui';
+import { ItemFooter } from '@databricks/appkit-ui/react';
```
@@ -129,7 +129,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemGroup } from '@databricks/appkit-ui';
+import { ItemGroup } from '@databricks/appkit-ui/react';
```
@@ -150,7 +150,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemHeader } from '@databricks/appkit-ui';
+import { ItemHeader } from '@databricks/appkit-ui/react';
```
@@ -173,7 +173,7 @@ import { ItemHeader } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ItemMedia } from '@databricks/appkit-ui';
+import { ItemMedia } from '@databricks/appkit-ui/react';
```
@@ -198,7 +198,7 @@ import { ItemMedia } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ItemSeparator } from '@databricks/appkit-ui';
+import { ItemSeparator } from '@databricks/appkit-ui/react';
```
@@ -219,7 +219,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { ItemTitle } from '@databricks/appkit-ui';
+import { ItemTitle } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Kbd.mdx b/docs/docs/api/appkit-ui/ui/Kbd.mdx
index 298863848..342d808bb 100644
--- a/docs/docs/api/appkit-ui/ui/Kbd.mdx
+++ b/docs/docs/api/appkit-ui/ui/Kbd.mdx
@@ -20,7 +20,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Kbd } from '@databricks/appkit-ui';
+import { Kbd } from '@databricks/appkit-ui/react';
```
@@ -41,7 +41,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { KbdGroup } from '@databricks/appkit-ui';
+import { KbdGroup } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Label.mdx b/docs/docs/api/appkit-ui/ui/Label.mdx
index 547a5a16c..21a110b62 100644
--- a/docs/docs/api/appkit-ui/ui/Label.mdx
+++ b/docs/docs/api/appkit-ui/ui/Label.mdx
@@ -29,7 +29,7 @@ Text label associated with form controls
### Usage
```tsx
-import { Label } from '@databricks/appkit-ui';
+import { Label } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Menubar.mdx b/docs/docs/api/appkit-ui/ui/Menubar.mdx
index 5e8ddaf48..efd9c3d11 100644
--- a/docs/docs/api/appkit-ui/ui/Menubar.mdx
+++ b/docs/docs/api/appkit-ui/ui/Menubar.mdx
@@ -34,7 +34,7 @@ Horizontal menu bar with dropdown menus
### Usage
```tsx
-import { Menubar } from '@databricks/appkit-ui';
+import { Menubar } from '@databricks/appkit-ui/react';
```
@@ -62,7 +62,7 @@ import { Menubar } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarCheckboxItem } from '@databricks/appkit-ui';
+import { MenubarCheckboxItem } from '@databricks/appkit-ui/react';
```
@@ -103,7 +103,7 @@ import { MenubarCheckboxItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarContent } from '@databricks/appkit-ui';
+import { MenubarContent } from '@databricks/appkit-ui/react';
```
@@ -126,7 +126,7 @@ import { MenubarContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarGroup } from '@databricks/appkit-ui';
+import { MenubarGroup } from '@databricks/appkit-ui/react';
```
@@ -154,7 +154,7 @@ import { MenubarGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarItem } from '@databricks/appkit-ui';
+import { MenubarItem } from '@databricks/appkit-ui/react';
```
@@ -178,7 +178,7 @@ import { MenubarItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarLabel } from '@databricks/appkit-ui';
+import { MenubarLabel } from '@databricks/appkit-ui/react';
```
@@ -202,7 +202,7 @@ import { MenubarLabel } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarMenu } from '@databricks/appkit-ui';
+import { MenubarMenu } from '@databricks/appkit-ui/react';
```
@@ -226,7 +226,7 @@ import { MenubarMenu } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarPortal } from '@databricks/appkit-ui';
+import { MenubarPortal } from '@databricks/appkit-ui/react';
```
@@ -251,7 +251,7 @@ import { MenubarPortal } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarRadioGroup } from '@databricks/appkit-ui';
+import { MenubarRadioGroup } from '@databricks/appkit-ui/react';
```
@@ -278,7 +278,7 @@ import { MenubarRadioGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarRadioItem } from '@databricks/appkit-ui';
+import { MenubarRadioItem } from '@databricks/appkit-ui/react';
```
@@ -301,7 +301,7 @@ import { MenubarRadioItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarSeparator } from '@databricks/appkit-ui';
+import { MenubarSeparator } from '@databricks/appkit-ui/react';
```
@@ -322,7 +322,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { MenubarShortcut } from '@databricks/appkit-ui';
+import { MenubarShortcut } from '@databricks/appkit-ui/react';
```
@@ -347,7 +347,7 @@ import { MenubarShortcut } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarSub } from '@databricks/appkit-ui';
+import { MenubarSub } from '@databricks/appkit-ui/react';
```
@@ -385,7 +385,7 @@ import { MenubarSub } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarSubContent } from '@databricks/appkit-ui';
+import { MenubarSubContent } from '@databricks/appkit-ui/react';
```
@@ -411,7 +411,7 @@ import { MenubarSubContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarSubTrigger } from '@databricks/appkit-ui';
+import { MenubarSubTrigger } from '@databricks/appkit-ui/react';
```
@@ -434,7 +434,7 @@ import { MenubarSubTrigger } from '@databricks/appkit-ui';
### Usage
```tsx
-import { MenubarTrigger } from '@databricks/appkit-ui';
+import { MenubarTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/NavigationMenu.mdx b/docs/docs/api/appkit-ui/ui/NavigationMenu.mdx
index 008e59c2a..93ea8668d 100644
--- a/docs/docs/api/appkit-ui/ui/NavigationMenu.mdx
+++ b/docs/docs/api/appkit-ui/ui/NavigationMenu.mdx
@@ -37,7 +37,7 @@ Horizontal navigation menu with dropdown submenus
### Usage
```tsx
-import { NavigationMenu } from '@databricks/appkit-ui';
+import { NavigationMenu } from '@databricks/appkit-ui/react';
```
@@ -67,7 +67,7 @@ Dropdown content area for navigation submenu
### Usage
```tsx
-import { NavigationMenuContent } from '@databricks/appkit-ui';
+import { NavigationMenuContent } from '@databricks/appkit-ui/react';
```
@@ -93,7 +93,7 @@ Visual indicator for active navigation menu item
### Usage
```tsx
-import { NavigationMenuIndicator } from '@databricks/appkit-ui';
+import { NavigationMenuIndicator } from '@databricks/appkit-ui/react';
```
@@ -119,7 +119,7 @@ Individual navigation menu item
### Usage
```tsx
-import { NavigationMenuItem } from '@databricks/appkit-ui';
+import { NavigationMenuItem } from '@databricks/appkit-ui/react';
```
@@ -146,7 +146,7 @@ Clickable link within navigation menu
### Usage
```tsx
-import { NavigationMenuLink } from '@databricks/appkit-ui';
+import { NavigationMenuLink } from '@databricks/appkit-ui/react';
```
@@ -171,7 +171,7 @@ Container list for navigation menu items
### Usage
```tsx
-import { NavigationMenuList } from '@databricks/appkit-ui';
+import { NavigationMenuList } from '@databricks/appkit-ui/react';
```
@@ -196,7 +196,7 @@ Button that opens a navigation submenu
### Usage
```tsx
-import { NavigationMenuTrigger } from '@databricks/appkit-ui';
+import { NavigationMenuTrigger } from '@databricks/appkit-ui/react';
```
@@ -222,7 +222,7 @@ Viewport container for navigation menu content
### Usage
```tsx
-import { NavigationMenuViewport } from '@databricks/appkit-ui';
+import { NavigationMenuViewport } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Pagination.mdx b/docs/docs/api/appkit-ui/ui/Pagination.mdx
index 1e930d77f..1ba89cc86 100644
--- a/docs/docs/api/appkit-ui/ui/Pagination.mdx
+++ b/docs/docs/api/appkit-ui/ui/Pagination.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Pagination } from '@databricks/appkit-ui';
+import { Pagination } from '@databricks/appkit-ui/react';
```
@@ -50,7 +50,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { PaginationContent } from '@databricks/appkit-ui';
+import { PaginationContent } from '@databricks/appkit-ui/react';
```
@@ -73,7 +73,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { PaginationEllipsis } from '@databricks/appkit-ui';
+import { PaginationEllipsis } from '@databricks/appkit-ui/react';
```
@@ -96,7 +96,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { PaginationItem } from '@databricks/appkit-ui';
+import { PaginationItem } from '@databricks/appkit-ui/react';
```
@@ -122,7 +122,7 @@ Clickable link for navigating to a specific page
### Usage
```tsx
-import { PaginationLink } from '@databricks/appkit-ui';
+import { PaginationLink } from '@databricks/appkit-ui/react';
```
@@ -148,7 +148,7 @@ Button for navigating to the next page
### Usage
```tsx
-import { PaginationNext } from '@databricks/appkit-ui';
+import { PaginationNext } from '@databricks/appkit-ui/react';
```
@@ -174,7 +174,7 @@ Button for navigating to the previous page
### Usage
```tsx
-import { PaginationPrevious } from '@databricks/appkit-ui';
+import { PaginationPrevious } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Popover.mdx b/docs/docs/api/appkit-ui/ui/Popover.mdx
index 165db05be..4fc1512c4 100644
--- a/docs/docs/api/appkit-ui/ui/Popover.mdx
+++ b/docs/docs/api/appkit-ui/ui/Popover.mdx
@@ -32,7 +32,7 @@ Floating content panel anchored to a trigger element
### Usage
```tsx
-import { Popover } from '@databricks/appkit-ui';
+import { Popover } from '@databricks/appkit-ui/react';
```
@@ -56,7 +56,7 @@ import { Popover } from '@databricks/appkit-ui';
### Usage
```tsx
-import { PopoverAnchor } from '@databricks/appkit-ui';
+import { PopoverAnchor } from '@databricks/appkit-ui/react';
```
@@ -97,7 +97,7 @@ import { PopoverAnchor } from '@databricks/appkit-ui';
### Usage
```tsx
-import { PopoverContent } from '@databricks/appkit-ui';
+import { PopoverContent } from '@databricks/appkit-ui/react';
```
@@ -120,7 +120,7 @@ import { PopoverContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { PopoverTrigger } from '@databricks/appkit-ui';
+import { PopoverTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Progress.mdx b/docs/docs/api/appkit-ui/ui/Progress.mdx
index eaee62c02..7f477e450 100644
--- a/docs/docs/api/appkit-ui/ui/Progress.mdx
+++ b/docs/docs/api/appkit-ui/ui/Progress.mdx
@@ -32,7 +32,7 @@ Visual indicator showing task completion percentage
### Usage
```tsx
-import { Progress } from '@databricks/appkit-ui';
+import { Progress } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/RadioGroup.mdx b/docs/docs/api/appkit-ui/ui/RadioGroup.mdx
index bd82a8405..1b177c514 100644
--- a/docs/docs/api/appkit-ui/ui/RadioGroup.mdx
+++ b/docs/docs/api/appkit-ui/ui/RadioGroup.mdx
@@ -38,7 +38,7 @@ Group of radio buttons for selecting a single option
### Usage
```tsx
-import { RadioGroup } from '@databricks/appkit-ui';
+import { RadioGroup } from '@databricks/appkit-ui/react';
```
@@ -64,7 +64,7 @@ import { RadioGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { RadioGroupItem } from '@databricks/appkit-ui';
+import { RadioGroupItem } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/ResizableHandle.mdx b/docs/docs/api/appkit-ui/ui/ResizableHandle.mdx
index 3595485c2..4902ae40c 100644
--- a/docs/docs/api/appkit-ui/ui/ResizableHandle.mdx
+++ b/docs/docs/api/appkit-ui/ui/ResizableHandle.mdx
@@ -39,7 +39,7 @@ Draggable handle for resizing panels
### Usage
```tsx
-import { ResizableHandle } from '@databricks/appkit-ui';
+import { ResizableHandle } from '@databricks/appkit-ui/react';
```
@@ -74,7 +74,7 @@ Individual resizable panel within a panel group
### Usage
```tsx
-import { ResizablePanel } from '@databricks/appkit-ui';
+import { ResizablePanel } from '@databricks/appkit-ui/react';
```
@@ -105,7 +105,7 @@ Container for resizable panel layout
### Usage
```tsx
-import { ResizablePanelGroup } from '@databricks/appkit-ui';
+import { ResizablePanelGroup } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/ScrollArea.mdx b/docs/docs/api/appkit-ui/ui/ScrollArea.mdx
index 11f808e33..89a6ea46a 100644
--- a/docs/docs/api/appkit-ui/ui/ScrollArea.mdx
+++ b/docs/docs/api/appkit-ui/ui/ScrollArea.mdx
@@ -32,7 +32,7 @@ Container with custom scrollbars for overflow content
### Usage
```tsx
-import { ScrollArea } from '@databricks/appkit-ui';
+import { ScrollArea } from '@databricks/appkit-ui/react';
```
@@ -59,7 +59,7 @@ Scrollbar component for the scroll area
### Usage
```tsx
-import { ScrollBar } from '@databricks/appkit-ui';
+import { ScrollBar } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Select.mdx b/docs/docs/api/appkit-ui/ui/Select.mdx
index e05e8efe2..c6b7640b6 100644
--- a/docs/docs/api/appkit-ui/ui/Select.mdx
+++ b/docs/docs/api/appkit-ui/ui/Select.mdx
@@ -40,7 +40,7 @@ Dropdown control for selecting a value from a list
### Usage
```tsx
-import { Select } from '@databricks/appkit-ui';
+import { Select } from '@databricks/appkit-ui/react';
```
@@ -78,7 +78,7 @@ import { Select } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectContent } from '@databricks/appkit-ui';
+import { SelectContent } from '@databricks/appkit-ui/react';
```
@@ -101,7 +101,7 @@ import { SelectContent } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectGroup } from '@databricks/appkit-ui';
+import { SelectGroup } from '@databricks/appkit-ui/react';
```
@@ -129,7 +129,7 @@ Select item component for individual options in a dropdown.
### Usage
```tsx
-import { SelectItem } from '@databricks/appkit-ui';
+import { SelectItem } from '@databricks/appkit-ui/react';
```
@@ -152,7 +152,7 @@ import { SelectItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectLabel } from '@databricks/appkit-ui';
+import { SelectLabel } from '@databricks/appkit-ui/react';
```
@@ -175,7 +175,7 @@ import { SelectLabel } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectScrollDownButton } from '@databricks/appkit-ui';
+import { SelectScrollDownButton } from '@databricks/appkit-ui/react';
```
@@ -198,7 +198,7 @@ import { SelectScrollDownButton } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectScrollUpButton } from '@databricks/appkit-ui';
+import { SelectScrollUpButton } from '@databricks/appkit-ui/react';
```
@@ -221,7 +221,7 @@ import { SelectScrollUpButton } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectSeparator } from '@databricks/appkit-ui';
+import { SelectSeparator } from '@databricks/appkit-ui/react';
```
@@ -245,7 +245,7 @@ import { SelectSeparator } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectTrigger } from '@databricks/appkit-ui';
+import { SelectTrigger } from '@databricks/appkit-ui/react';
```
@@ -269,7 +269,7 @@ import { SelectTrigger } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SelectValue } from '@databricks/appkit-ui';
+import { SelectValue } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Separator.mdx b/docs/docs/api/appkit-ui/ui/Separator.mdx
index 7cb84afc3..905486d16 100644
--- a/docs/docs/api/appkit-ui/ui/Separator.mdx
+++ b/docs/docs/api/appkit-ui/ui/Separator.mdx
@@ -31,7 +31,7 @@ Visual divider line between content sections
### Usage
```tsx
-import { Separator } from '@databricks/appkit-ui';
+import { Separator } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Sheet.mdx b/docs/docs/api/appkit-ui/ui/Sheet.mdx
index db44e37e9..eda755af5 100644
--- a/docs/docs/api/appkit-ui/ui/Sheet.mdx
+++ b/docs/docs/api/appkit-ui/ui/Sheet.mdx
@@ -32,7 +32,7 @@ Sliding panel that overlays content from screen edges
### Usage
```tsx
-import { Sheet } from '@databricks/appkit-ui';
+import { Sheet } from '@databricks/appkit-ui/react';
```
@@ -57,7 +57,7 @@ Button that closes the sheet
### Usage
```tsx
-import { SheetClose } from '@databricks/appkit-ui';
+import { SheetClose } from '@databricks/appkit-ui/react';
```
@@ -90,7 +90,7 @@ Main content area of the sheet
### Usage
```tsx
-import { SheetContent } from '@databricks/appkit-ui';
+import { SheetContent } from '@databricks/appkit-ui/react';
```
@@ -115,7 +115,7 @@ Description text for the sheet
### Usage
```tsx
-import { SheetDescription } from '@databricks/appkit-ui';
+import { SheetDescription } from '@databricks/appkit-ui/react';
```
@@ -138,7 +138,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SheetFooter } from '@databricks/appkit-ui';
+import { SheetFooter } from '@databricks/appkit-ui/react';
```
@@ -161,7 +161,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SheetHeader } from '@databricks/appkit-ui';
+import { SheetHeader } from '@databricks/appkit-ui/react';
```
@@ -186,7 +186,7 @@ Title text for the sheet
### Usage
```tsx
-import { SheetTitle } from '@databricks/appkit-ui';
+import { SheetTitle } from '@databricks/appkit-ui/react';
```
@@ -211,7 +211,7 @@ Button that opens the sheet
### Usage
```tsx
-import { SheetTrigger } from '@databricks/appkit-ui';
+import { SheetTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Sidebar.mdx b/docs/docs/api/appkit-ui/ui/Sidebar.mdx
index 13368fa4b..5c9fdea3b 100644
--- a/docs/docs/api/appkit-ui/ui/Sidebar.mdx
+++ b/docs/docs/api/appkit-ui/ui/Sidebar.mdx
@@ -31,7 +31,7 @@ Collapsible navigation sidebar with mobile support
### Usage
```tsx
-import { Sidebar } from '@databricks/appkit-ui';
+import { Sidebar } from '@databricks/appkit-ui/react';
```
@@ -54,7 +54,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarContent } from '@databricks/appkit-ui';
+import { SidebarContent } from '@databricks/appkit-ui/react';
```
@@ -77,7 +77,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarFooter } from '@databricks/appkit-ui';
+import { SidebarFooter } from '@databricks/appkit-ui/react';
```
@@ -100,7 +100,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarGroup } from '@databricks/appkit-ui';
+import { SidebarGroup } from '@databricks/appkit-ui/react';
```
@@ -125,7 +125,7 @@ Action button displayed next to a sidebar group label
### Usage
```tsx
-import { SidebarGroupAction } from '@databricks/appkit-ui';
+import { SidebarGroupAction } from '@databricks/appkit-ui/react';
```
@@ -148,7 +148,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarGroupContent } from '@databricks/appkit-ui';
+import { SidebarGroupContent } from '@databricks/appkit-ui/react';
```
@@ -173,7 +173,7 @@ Label heading for a sidebar group
### Usage
```tsx
-import { SidebarGroupLabel } from '@databricks/appkit-ui';
+import { SidebarGroupLabel } from '@databricks/appkit-ui/react';
```
@@ -196,7 +196,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarHeader } from '@databricks/appkit-ui';
+import { SidebarHeader } from '@databricks/appkit-ui/react';
```
@@ -219,7 +219,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarInput } from '@databricks/appkit-ui';
+import { SidebarInput } from '@databricks/appkit-ui/react';
```
@@ -242,7 +242,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarInset } from '@databricks/appkit-ui';
+import { SidebarInset } from '@databricks/appkit-ui/react';
```
@@ -265,7 +265,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarMenu } from '@databricks/appkit-ui';
+import { SidebarMenu } from '@databricks/appkit-ui/react';
```
@@ -291,7 +291,7 @@ Action button displayed alongside a menu item
### Usage
```tsx
-import { SidebarMenuAction } from '@databricks/appkit-ui';
+import { SidebarMenuAction } from '@databricks/appkit-ui/react';
```
@@ -314,7 +314,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarMenuBadge } from '@databricks/appkit-ui';
+import { SidebarMenuBadge } from '@databricks/appkit-ui/react';
```
@@ -341,7 +341,7 @@ import { SidebarMenuBadge } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SidebarMenuButton } from '@databricks/appkit-ui';
+import { SidebarMenuButton } from '@databricks/appkit-ui/react';
```
@@ -364,7 +364,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarMenuItem } from '@databricks/appkit-ui';
+import { SidebarMenuItem } from '@databricks/appkit-ui/react';
```
@@ -389,7 +389,7 @@ Loading skeleton placeholder for menu items
### Usage
```tsx
-import { SidebarMenuSkeleton } from '@databricks/appkit-ui';
+import { SidebarMenuSkeleton } from '@databricks/appkit-ui/react';
```
@@ -412,7 +412,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarMenuSub } from '@databricks/appkit-ui';
+import { SidebarMenuSub } from '@databricks/appkit-ui/react';
```
@@ -439,7 +439,7 @@ Button for submenu items
### Usage
```tsx
-import { SidebarMenuSubButton } from '@databricks/appkit-ui';
+import { SidebarMenuSubButton } from '@databricks/appkit-ui/react';
```
@@ -462,7 +462,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarMenuSubItem } from '@databricks/appkit-ui';
+import { SidebarMenuSubItem } from '@databricks/appkit-ui/react';
```
@@ -487,7 +487,7 @@ import { SidebarMenuSubItem } from '@databricks/appkit-ui';
### Usage
```tsx
-import { SidebarProvider } from '@databricks/appkit-ui';
+import { SidebarProvider } from '@databricks/appkit-ui/react';
```
@@ -510,7 +510,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { SidebarRail } from '@databricks/appkit-ui';
+import { SidebarRail } from '@databricks/appkit-ui/react';
```
@@ -537,7 +537,7 @@ Visual separator between sidebar sections
### Usage
```tsx
-import { SidebarSeparator } from '@databricks/appkit-ui';
+import { SidebarSeparator } from '@databricks/appkit-ui/react';
```
@@ -564,7 +564,7 @@ Button that toggles the sidebar open and closed
### Usage
```tsx
-import { SidebarTrigger } from '@databricks/appkit-ui';
+import { SidebarTrigger } from '@databricks/appkit-ui/react';
```
@@ -587,7 +587,7 @@ This hook takes no parameters.
### Usage
```tsx
-import { useSidebar } from '@databricks/appkit-ui';
+import { useSidebar } from '@databricks/appkit-ui/react';
function MyComponent() {
const sidebar = useSidebar();
diff --git a/docs/docs/api/appkit-ui/ui/Skeleton.mdx b/docs/docs/api/appkit-ui/ui/Skeleton.mdx
index abb766300..27f8abb25 100644
--- a/docs/docs/api/appkit-ui/ui/Skeleton.mdx
+++ b/docs/docs/api/appkit-ui/ui/Skeleton.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Skeleton } from '@databricks/appkit-ui';
+import { Skeleton } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Slider.mdx b/docs/docs/api/appkit-ui/ui/Slider.mdx
index 8402c82f1..392a42e6f 100644
--- a/docs/docs/api/appkit-ui/ui/Slider.mdx
+++ b/docs/docs/api/appkit-ui/ui/Slider.mdx
@@ -43,7 +43,7 @@ Draggable input for selecting numeric values within a range
### Usage
```tsx
-import { Slider } from '@databricks/appkit-ui';
+import { Slider } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Spinner.mdx b/docs/docs/api/appkit-ui/ui/Spinner.mdx
index 007833811..b68f9649f 100644
--- a/docs/docs/api/appkit-ui/ui/Spinner.mdx
+++ b/docs/docs/api/appkit-ui/ui/Spinner.mdx
@@ -20,7 +20,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Spinner } from '@databricks/appkit-ui';
+import { Spinner } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Switch.mdx b/docs/docs/api/appkit-ui/ui/Switch.mdx
index 8fb880781..61c828f5c 100644
--- a/docs/docs/api/appkit-ui/ui/Switch.mdx
+++ b/docs/docs/api/appkit-ui/ui/Switch.mdx
@@ -33,7 +33,7 @@ Toggle control for switching between on and off states
### Usage
```tsx
-import { Switch } from '@databricks/appkit-ui';
+import { Switch } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Table.mdx b/docs/docs/api/appkit-ui/ui/Table.mdx
index 90b5c7d5c..9a3dd9824 100644
--- a/docs/docs/api/appkit-ui/ui/Table.mdx
+++ b/docs/docs/api/appkit-ui/ui/Table.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Table } from '@databricks/appkit-ui';
+import { Table } from '@databricks/appkit-ui/react';
```
@@ -48,7 +48,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableBody } from '@databricks/appkit-ui';
+import { TableBody } from '@databricks/appkit-ui/react';
```
@@ -69,7 +69,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableCaption } from '@databricks/appkit-ui';
+import { TableCaption } from '@databricks/appkit-ui/react';
```
@@ -90,7 +90,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableCell } from '@databricks/appkit-ui';
+import { TableCell } from '@databricks/appkit-ui/react';
```
@@ -111,7 +111,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableFooter } from '@databricks/appkit-ui';
+import { TableFooter } from '@databricks/appkit-ui/react';
```
@@ -132,7 +132,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableHead } from '@databricks/appkit-ui';
+import { TableHead } from '@databricks/appkit-ui/react';
```
@@ -153,7 +153,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableHeader } from '@databricks/appkit-ui';
+import { TableHeader } from '@databricks/appkit-ui/react';
```
@@ -174,7 +174,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { TableRow } from '@databricks/appkit-ui';
+import { TableRow } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Tabs.mdx b/docs/docs/api/appkit-ui/ui/Tabs.mdx
index e6269f43d..e59bc56ba 100644
--- a/docs/docs/api/appkit-ui/ui/Tabs.mdx
+++ b/docs/docs/api/appkit-ui/ui/Tabs.mdx
@@ -35,7 +35,7 @@ Tabbed interface for organizing content into separate panels
### Usage
```tsx
-import { Tabs } from '@databricks/appkit-ui';
+import { Tabs } from '@databricks/appkit-ui/react';
```
@@ -62,7 +62,7 @@ Content panel associated with a tab
### Usage
```tsx
-import { TabsContent } from '@databricks/appkit-ui';
+import { TabsContent } from '@databricks/appkit-ui/react';
```
@@ -88,7 +88,7 @@ Container for tab trigger buttons
### Usage
```tsx
-import { TabsList } from '@databricks/appkit-ui';
+import { TabsList } from '@databricks/appkit-ui/react';
```
@@ -114,7 +114,7 @@ Button that activates a tab panel
### Usage
```tsx
-import { TabsTrigger } from '@databricks/appkit-ui';
+import { TabsTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Textarea.mdx b/docs/docs/api/appkit-ui/ui/Textarea.mdx
index ed7c40c89..42f5cf7af 100644
--- a/docs/docs/api/appkit-ui/ui/Textarea.mdx
+++ b/docs/docs/api/appkit-ui/ui/Textarea.mdx
@@ -27,7 +27,7 @@ This component extends standard HTML element attributes.
### Usage
```tsx
-import { Textarea } from '@databricks/appkit-ui';
+import { Textarea } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Toaster.mdx b/docs/docs/api/appkit-ui/ui/Toaster.mdx
index d3b8dc26c..22cac5d4b 100644
--- a/docs/docs/api/appkit-ui/ui/Toaster.mdx
+++ b/docs/docs/api/appkit-ui/ui/Toaster.mdx
@@ -48,7 +48,7 @@ Toast notification system for displaying temporary messages
### Usage
```tsx
-import { Toaster } from '@databricks/appkit-ui';
+import { Toaster } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Toggle.mdx b/docs/docs/api/appkit-ui/ui/Toggle.mdx
index 45377ae7f..163859fd6 100644
--- a/docs/docs/api/appkit-ui/ui/Toggle.mdx
+++ b/docs/docs/api/appkit-ui/ui/Toggle.mdx
@@ -34,7 +34,7 @@ Button that toggles between pressed and unpressed states
### Usage
```tsx
-import { Toggle } from '@databricks/appkit-ui';
+import { Toggle } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/ToggleGroup.mdx b/docs/docs/api/appkit-ui/ui/ToggleGroup.mdx
index 15a577262..863036750 100644
--- a/docs/docs/api/appkit-ui/ui/ToggleGroup.mdx
+++ b/docs/docs/api/appkit-ui/ui/ToggleGroup.mdx
@@ -41,7 +41,7 @@ Group of toggle buttons for selecting one or more options
### Usage
```tsx
-import { ToggleGroup } from '@databricks/appkit-ui';
+import { ToggleGroup } from '@databricks/appkit-ui/react';
```
@@ -67,7 +67,7 @@ import { ToggleGroup } from '@databricks/appkit-ui';
### Usage
```tsx
-import { ToggleGroupItem } from '@databricks/appkit-ui';
+import { ToggleGroupItem } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/api/appkit-ui/ui/Tooltip.mdx b/docs/docs/api/appkit-ui/ui/Tooltip.mdx
index 7735698c0..50e2dce60 100644
--- a/docs/docs/api/appkit-ui/ui/Tooltip.mdx
+++ b/docs/docs/api/appkit-ui/ui/Tooltip.mdx
@@ -33,7 +33,7 @@ Brief informational message that appears on hover
### Usage
```tsx
-import { Tooltip } from '@databricks/appkit-ui';
+import { Tooltip } from '@databricks/appkit-ui/react';
```
@@ -71,7 +71,7 @@ import { Tooltip } from '@databricks/appkit-ui';
### Usage
```tsx
-import { TooltipContent } from '@databricks/appkit-ui';
+import { TooltipContent } from '@databricks/appkit-ui/react';
```
@@ -98,7 +98,7 @@ Context provider for tooltip configuration
### Usage
```tsx
-import { TooltipProvider } from '@databricks/appkit-ui';
+import { TooltipProvider } from '@databricks/appkit-ui/react';
```
@@ -121,7 +121,7 @@ import { TooltipProvider } from '@databricks/appkit-ui';
### Usage
```tsx
-import { TooltipTrigger } from '@databricks/appkit-ui';
+import { TooltipTrigger } from '@databricks/appkit-ui/react';
```
diff --git a/docs/docs/plugins/analytics.md b/docs/docs/plugins/analytics.md
index 577f6a0c9..b1e208a00 100644
--- a/docs/docs/plugins/analytics.md
+++ b/docs/docs/plugins/analytics.md
@@ -483,7 +483,7 @@ function useLakebaseReadiness() {
```tsx
import { useAnalyticsQuery } from "@databricks/appkit-ui/react";
import { sql } from "@databricks/appkit-ui/js";
-import { Skeleton } from "@databricks/appkit-ui";
+import { Skeleton } from "@databricks/appkit-ui/react";
function SpendTable() {
const { data, loading, error } = useAnalyticsQuery("spend_summary", {
diff --git a/docs/src/components/DocExample/examples.gen.ts b/docs/src/components/DocExample/examples.gen.ts
index 254abe364..2f1330873 100644
--- a/docs/src/components/DocExample/examples.gen.ts
+++ b/docs/src/components/DocExample/examples.gen.ts
@@ -162,25 +162,40 @@ export default function AlertExample() {
},
"area": {
Component: AreaExample,
- source: `"use client";
-
-import { AreaChart } from "@databricks/appkit-ui/react";
+ source: `import { AreaChart } from "@databricks/appkit-ui/react";
+
+// Long rows as \`config/queries/revenue_by_channel.sql\` returns them, one row
+// per month and channel; \`seriesKey\` turns each channel into a stacked band.
+// SELECT DATE_TRUNC('MONTH', order_date) AS month, channel,
+// CAST(SUM(amount) AS DOUBLE) AS revenue
+// FROM orders GROUP BY 1, 2 ORDER BY 1
+const rows = [
+ { month: "2026-01-01", channel: "Online", revenue: 412000 },
+ { month: "2026-01-01", channel: "Retail", revenue: 268000 },
+ { month: "2026-02-01", channel: "Online", revenue: 451000 },
+ { month: "2026-02-01", channel: "Retail", revenue: 259000 },
+ { month: "2026-03-01", channel: "Online", revenue: 498000 },
+ { month: "2026-03-01", channel: "Retail", revenue: 281000 },
+ { month: "2026-04-01", channel: "Online", revenue: 530000 },
+ { month: "2026-04-01", channel: "Retail", revenue: 274000 },
+];
+
+const usd = (value: string | number) =>
+ new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+ notation: "compact",
+ }).format(Number(value));
export default function AreaChartExample() {
return (
);
@@ -233,22 +248,35 @@ export default function BadgeExample() {
},
"bar": {
Component: BarExample,
- source: `"use client";
-
-import { BarChart } from "@databricks/appkit-ui/react";
+ source: `import { BarChart } from "@databricks/appkit-ui/react";
+
+// Rows as \`config/queries/revenue_by_segment.sql\` returns them:
+// SELECT segment, CAST(SUM(amount) AS DOUBLE) AS revenue
+// FROM orders GROUP BY segment ORDER BY revenue DESC LIMIT 10
+// In an app, pass the query instead of the rows:
+//
+const rows = [
+ { segment: "Enterprise", revenue: 1840500 },
+ { segment: "Mid-market", revenue: 1215300 },
+ { segment: "SMB", revenue: 864200 },
+ { segment: "Public sector", revenue: 512900 },
+ { segment: "Education", revenue: 301750 },
+];
+
+const usd = (value: string | number) =>
+ new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+ notation: "compact",
+ }).format(Number(value));
export default function BarChartExample() {
return (
);
@@ -666,17 +694,37 @@ export default function ContextMenuExample() {
},
"data-table": {
Component: DataTableExample,
- source: `"use client";
-
-import { DataTable } from "@databricks/appkit-ui/react";
+ source: `import { DataTable } from "@databricks/appkit-ui/react";
+
+// Detail rows with typed columns. In an app, pass the query instead of rows:
+//
+const rows = [
+ { order_id: "00412", customer: "Acme", amount: 1840.5, shipped: true },
+ { order_id: "00413", customer: "Globex", amount: 215.0, shipped: false },
+ { order_id: "00414", customer: "Initech", amount: 9310.25, shipped: true },
+ { order_id: "00415", customer: "Hooli", amount: null, shipped: false },
+];
+
+const usd = new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+});
export default function DataTableExample() {
return (
(value == null ? "—" : usd.format(Number(value))),
+ align: "right",
+ },
+ { key: "shipped" },
+ ]}
+ defaultSort={{ key: "amount", desc: true }}
pageSize={10}
/>
);
@@ -744,19 +792,25 @@ export default function DialogExample() {
},
"donut": {
Component: DonutExample,
- source: `"use client";
-
-import { DonutChart } from "@databricks/appkit-ui/react";
+ source: `import { DonutChart } from "@databricks/appkit-ui/react";
+
+// Headcount by department, with the total in the hole.
+// SELECT department, COUNT(*) AS headcount FROM employees
+// GROUP BY department ORDER BY headcount DESC
+const rows = [
+ { department: "Engineering", headcount: 450 },
+ { department: "Sales", headcount: 300 },
+ { department: "Marketing", headcount: 250 },
+ { department: "Operations", headcount: 200 },
+];
export default function DonutChartExample() {
return (
);
@@ -986,31 +1040,31 @@ export default function GenieChatExample() {
},
"heatmap": {
Component: HeatmapExample,
- source: `"use client";
-
-import { HeatmapChart } from "@databricks/appkit-ui/react";
+ source: `import { HeatmapChart } from "@databricks/appkit-ui/react";
+
+// One row per cell, as \`config/queries/orders_by_hour.sql\` returns them.
+// Weekdays are put in calendar order whatever the row order.
+// SELECT DATE_FORMAT(created_at, 'E') AS weekday, HOUR(created_at) AS hour,
+// COUNT(*) AS orders
+// FROM orders GROUP BY 1, 2
+const weekdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
+const hours = [8, 10, 12, 14, 16, 18];
+const rows = weekdays.flatMap((weekday, d) =>
+ hours.map((hour, h) => ({
+ weekday,
+ hour,
+ // Busy at lunch and on weekdays: a fixed pattern, not random data.
+ orders: (d < 5 ? 60 : 25) + (h === 2 ? 40 : 0) + ((d * 7 + h * 3) % 11),
+ })),
+);
export default function HeatmapChartExample() {
- const data = [];
- const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
- const hours = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"];
-
- for (const day of days) {
- for (const hour of hours) {
- data.push({
- day,
- hour,
- count: Math.floor(Math.random() * 100),
- });
- }
- }
-
return (
);
@@ -1117,24 +1171,31 @@ export default function LabelExample() {
},
"line": {
Component: LineExample,
- source: `"use client";
-
-import { LineChart } from "@databricks/appkit-ui/react";
+ source: `import { LineChart } from "@databricks/appkit-ui/react";
+
+// Rows as \`config/queries/daily_orders.sql\` returns them: a DATE column and a
+// count, one row per day. A day with no data is null and shows as a gap with
+// \`defaults="v3"\`.
+// SELECT order_date, COUNT(*) AS orders FROM orders
+// WHERE order_date >= :start_date GROUP BY order_date ORDER BY order_date
+// In an app:
+const rows = [
+ { order_date: "2026-03-01", orders: 182 },
+ { order_date: "2026-03-02", orders: 205 },
+ { order_date: "2026-03-03", orders: 198 },
+ { order_date: "2026-03-04", orders: null },
+ { order_date: "2026-03-05", orders: 231 },
+ { order_date: "2026-03-06", orders: 264 },
+ { order_date: "2026-03-07", orders: 249 },
+];
export default function LineChartExample() {
return (
);
@@ -1441,22 +1502,20 @@ export default function PaginationExample() {
},
"pie": {
Component: PieExample,
- source: `"use client";
-
-import { PieChart } from "@databricks/appkit-ui/react";
+ source: `import { PieChart } from "@databricks/appkit-ui/react";
+
+// Two to five parts of one whole, as \`config/queries/tickets_by_priority.sql\`
+// returns them. More parts, or parts of similar size, read better as a bar chart.
+// SELECT priority, COUNT(*) AS tickets FROM tickets GROUP BY priority ORDER BY tickets DESC
+const rows = [
+ { priority: "Low", tickets: 412 },
+ { priority: "Medium", tickets: 268 },
+ { priority: "High", tickets: 121 },
+ { priority: "Urgent", tickets: 37 },
+];
export default function PieChartExample() {
- return (
-
- );
+ return ;
}
`,
},
@@ -1548,23 +1607,36 @@ export default function ProgressExample() {
},
"radar": {
Component: RadarExample,
- source: `"use client";
+ source: `import { RadarChart } from "@databricks/appkit-ui/react";
-import { RadarChart } from "@databricks/appkit-ui/react";
+// One row per entity, on one 0-100 scale, as a SQL query returns it.
+// \`metrics\` names the spokes; \`max\` fixes the rim at 100.
+// SELECT region, availability, latency_score, error_score, cost_score
+// FROM region_scores
+const rows = [
+ {
+ region: "us-east",
+ availability: 98,
+ latency_score: 82,
+ error_score: 91,
+ cost_score: 64,
+ },
+ {
+ region: "eu-west",
+ availability: 95,
+ latency_score: 88,
+ error_score: 79,
+ cost_score: 72,
+ },
+];
export default function RadarChartExample() {
return (
);
@@ -1637,25 +1709,28 @@ export default function ResizableExample() {
},
"scatter": {
Component: ScatterExample,
- source: `"use client";
-
-import { ScatterChart } from "@databricks/appkit-ui/react";
+ source: `import { ScatterChart } from "@databricks/appkit-ui/react";
+
+// Two measures per entity, as \`config/queries/customer_health.sql\` returns them.
+// Pass both keys: a scatter needs a numeric x and y.
+// SELECT customer, CAST(monthly_spend AS DOUBLE) AS monthly_spend, uptime_pct
+// FROM customer_health
+const rows = [
+ { customer: "Acme", monthly_spend: 5200, uptime_pct: 99.1 },
+ { customer: "Globex", monthly_spend: 5850, uptime_pct: 98.4 },
+ { customer: "Initech", monthly_spend: 5400, uptime_pct: 97.2 },
+ { customer: "Umbrella", monthly_spend: 6000, uptime_pct: 99.5 },
+ { customer: "Hooli", monthly_spend: 5050, uptime_pct: 98.9 },
+ { customer: "Stark", monthly_spend: 5600, uptime_pct: 97.8 },
+];
export default function ScatterChartExample() {
return (
\`\${value}%\`}
height={300}
/>
);
diff --git a/docs/static/appkit-ui/styles.gen.css b/docs/static/appkit-ui/styles.gen.css
index bb120c2ec..610428bc6 100644
--- a/docs/static/appkit-ui/styles.gen.css
+++ b/docs/static/appkit-ui/styles.gen.css
@@ -456,6 +456,9 @@
.mt-auto {
margin-top: auto;
}
+ .-mr-2 {
+ margin-right: calc(var(--spacing) * -2);
+ }
.mr-2 {
margin-right: calc(var(--spacing) * 2);
}
@@ -590,6 +593,10 @@
width: calc(var(--spacing) * 10);
height: calc(var(--spacing) * 10);
}
+ .size-80 {
+ width: calc(var(--spacing) * 80);
+ height: calc(var(--spacing) * 80);
+ }
.size-auto {
width: auto;
height: auto;
@@ -661,12 +668,18 @@
.h-\[1\.15rem\] {
height: 1.15rem;
}
+ .h-\[18rem\] {
+ height: 18rem;
+ }
.h-\[150px\] {
height: 150px;
}
.h-\[200px\] {
height: 200px;
}
+ .h-\[400px\] {
+ height: 400px;
+ }
.h-\[calc\(100\%-1px\)\] {
height: calc(100% - 1px);
}
@@ -700,12 +713,12 @@
.max-h-80 {
max-height: calc(var(--spacing) * 80);
}
+ .max-h-96 {
+ max-height: calc(var(--spacing) * 96);
+ }
.max-h-\[300px\] {
max-height: 300px;
}
- .max-h-\[600px\] {
- max-height: 600px;
- }
.min-h-0 {
min-height: calc(var(--spacing) * 0);
}
@@ -718,6 +731,9 @@
.min-h-\[100vh\] {
min-height: 100vh;
}
+ .min-h-\[200px\] {
+ min-height: 200px;
+ }
.min-h-screen {
min-height: 100vh;
}
@@ -907,6 +923,9 @@
.flex-shrink-0 {
flex-shrink: 0;
}
+ .shrink {
+ flex-shrink: 1;
+ }
.shrink-0 {
flex-shrink: 0;
}
@@ -1760,9 +1779,6 @@
.text-white {
color: var(--color-white);
}
- .capitalize {
- text-transform: capitalize;
- }
.lowercase {
text-transform: lowercase;
}
@@ -4248,6 +4264,11 @@
display: flex;
}
}
+ .md\:h-96 {
+ @media (width >= 48rem) {
+ height: calc(var(--spacing) * 96);
+ }
+ }
.md\:min-h-min {
@media (width >= 48rem) {
min-height: min-content;
diff --git a/packages/appkit-ui/src/js/arrow/arrow-client.test.ts b/packages/appkit-ui/src/js/arrow/arrow-client.test.ts
index d2d83b93a..aa35b93d9 100644
--- a/packages/appkit-ui/src/js/arrow/arrow-client.test.ts
+++ b/packages/appkit-ui/src/js/arrow/arrow-client.test.ts
@@ -1,7 +1,16 @@
-import { Table, tableToIPC, Utf8, vectorFromArray } from "apache-arrow";
+import {
+ DateDay,
+ Decimal,
+ makeVector,
+ Table,
+ TimestampMillisecond,
+ tableToIPC,
+ Utf8,
+ vectorFromArray,
+} from "apache-arrow";
import { describe, expect, test } from "vitest";
-import { ArrowClient } from "./arrow-client";
+import { ArrowClient, arrowRowsToObjects } from "./arrow-client";
/** Build an Arrow IPC stream (2 cols, 2 rows) with the given field names. */
function ipc(names: [string, string]): Uint8Array {
@@ -59,3 +68,38 @@ describe("ArrowClient.processArrowBuffer column relabeling", () => {
]);
});
});
+
+describe("arrowRowsToObjects", () => {
+ test("reads DECIMAL scaled, DATE as a day and TIMESTAMP as an ISO instant", () => {
+ const table = new Table({
+ amount: makeVector({
+ type: new Decimal(2, 10),
+ data: new Uint32Array([123456, 0, 0, 0, 5, 0, 0, 0]),
+ }),
+ day: makeVector({
+ type: new DateDay(),
+ data: new Int32Array([20454, 20455]),
+ }),
+ at: makeVector({
+ type: new TimestampMillisecond(),
+ data: new BigInt64Array([1767225600000n, 1767229200000n]),
+ }),
+ label: vectorFromArray(["a", "b"], new Utf8()),
+ });
+
+ expect(arrowRowsToObjects(table)).toEqual([
+ {
+ amount: 1234.56,
+ day: "2026-01-01",
+ at: "2026-01-01T00:00:00.000Z",
+ label: "a",
+ },
+ {
+ amount: 0.05,
+ day: "2026-01-02",
+ at: "2026-01-01T01:00:00.000Z",
+ label: "b",
+ },
+ ]);
+ });
+});
diff --git a/packages/appkit-ui/src/js/arrow/arrow-client.ts b/packages/appkit-ui/src/js/arrow/arrow-client.ts
index b2a4dc90d..d87a399ff 100644
--- a/packages/appkit-ui/src/js/arrow/arrow-client.ts
+++ b/packages/appkit-ui/src/js/arrow/arrow-client.ts
@@ -6,6 +6,7 @@ import {
NAME_FIELD_PATTERNS,
} from "../constants";
import {
+ ARROW_TYPE_IDS,
getArrowModule,
getDecimalTypeId,
getTypeIdSets,
@@ -146,13 +147,37 @@ export class ArrowClient {
/**
* Extracts chart data from Arrow table.
* Uses get(i) to properly handle complex types like Decimal128.
- * Applies decimal scaling for DECIMAL types.
+ * Applies decimal scaling for DECIMAL types. With `keepNulls`, null cells
+ * stay `null` instead of becoming 0.
*
* Note: This method assumes Arrow has been loaded (via processArrowBuffer).
*
* @returns xData for axis, yDataMap for series data
*/
- static extractChartData(table: Table, xKey: string, yKeys: string[]) {
+ static extractChartData(
+ table: Table,
+ xKey: string,
+ yKeys: string[],
+ opts: { keepNulls: boolean },
+ ): {
+ xData: (string | number | null)[];
+ yDataMap: Record;
+ };
+ /** With no options, missing cells become 0. */
+ static extractChartData(
+ table: Table,
+ xKey: string,
+ yKeys: string[],
+ ): {
+ xData: (string | number)[];
+ yDataMap: Record;
+ };
+ static extractChartData(
+ table: Table,
+ xKey: string,
+ yKeys: string[],
+ opts: { keepNulls: boolean } = { keepNulls: false },
+ ) {
// Early exit for empty tables - return cached empty object
if (table.numRows === 0) {
return EMPTY_RESULT;
@@ -175,14 +200,22 @@ export class ArrowClient {
// Extract X column using proper value extraction
const xCol = table.getChild(xKey);
- const xData = extractColumnValues(xCol, decimalDivisors.get(xKey));
+ const xData = extractColumnValues(
+ xCol,
+ decimalDivisors.get(xKey),
+ opts.keepNulls,
+ );
// Extract Y columns using proper value extraction
- const yDataMap: Record = {};
+ const yDataMap: Record = {};
for (let i = 0; i < yKeys.length; i++) {
const key = yKeys[i];
const col = table.getChild(key);
- yDataMap[key] = extractColumnValues(col, decimalDivisors.get(key));
+ yDataMap[key] = extractColumnValues(
+ col,
+ decimalDivisors.get(key),
+ opts.keepNulls,
+ );
}
return { xData, yDataMap };
@@ -375,6 +408,55 @@ const EMPTY_RESULT: {
yDataMap: {},
};
+/**
+ * Arrow rows in the shape the JSON rows have: DECIMAL scaled to its value, DATE
+ * as `YYYY-MM-DD` (the UTC day Arrow stores) and TIMESTAMP as an ISO 8601
+ * instant. `row.toJSON()` keeps DECIMAL as its unscaled integer and DATE and
+ * TIMESTAMP as epoch milliseconds, so transformers and tables read them wrong.
+ *
+ * Note: assumes Arrow has been loaded (via processArrowBuffer or a Table).
+ */
+export function arrowRowsToObjects(table: Table): Record[] {
+ const decimalType = getDecimalTypeId();
+ const scaled = table.schema.fields.flatMap((field) => {
+ const decType = field.type as { scale?: number };
+ const isDecimal = field.typeId === decimalType;
+ const isDate = field.typeId === ARROW_TYPE_IDS.Date;
+ const isTimestamp = field.typeId === ARROW_TYPE_IDS.Timestamp;
+ if (!isDecimal && !isDate && !isTimestamp) return [];
+ const divisor =
+ isDecimal && typeof decType.scale === "number"
+ ? 10 ** decType.scale
+ : undefined;
+ return [
+ {
+ name: field.name,
+ column: table.getChild(field.name),
+ divisor,
+ isDate,
+ isTimestamp,
+ },
+ ];
+ });
+ if (!scaled.length) return Array.from(table, (row) => ({ ...row.toJSON() }));
+
+ return Array.from(table, (row, i) => {
+ const json: Record = { ...row.toJSON() };
+ for (const { name, column, divisor, isDate, isTimestamp } of scaled) {
+ const value = column?.get(i);
+ if (value === null || value === undefined) {
+ json[name] = null;
+ } else if (divisor !== undefined) {
+ json[name] = Number(value) / divisor;
+ } else if (typeof value === "number" && Number.isFinite(value)) {
+ const iso = new Date(value).toISOString();
+ json[name] = isDate ? iso.slice(0, 10) : isTimestamp ? iso : value;
+ }
+ }
+ return json;
+ });
+}
+
/**
* Extracts values from an Arrow Vector properly.
* Uses get(i) to handle complex types like Decimal128 correctly.
@@ -386,17 +468,18 @@ const EMPTY_RESULT: {
function extractColumnValues(
col: { length: number; get: (i: number) => unknown } | null | undefined,
divisor?: number,
-): (string | number)[] {
+ keepNulls = false,
+): (string | number | null)[] {
if (!col) return [];
// Pre-allocate array for better performance with large datasets
const len = col.length;
- const result: (string | number)[] = new Array(len);
+ const result: (string | number | null)[] = new Array(len);
for (let i = 0; i < len; i++) {
const val = col.get(i);
if (val === null || val === undefined) {
- result[i] = 0;
+ result[i] = keepNulls ? null : 0;
} else if (typeof val === "bigint") {
// Apply decimal scaling if needed
const num = Number(val);
diff --git a/packages/appkit-ui/src/js/arrow/lazy-arrow.ts b/packages/appkit-ui/src/js/arrow/lazy-arrow.ts
index c36a7fa4a..517e9674e 100644
--- a/packages/appkit-ui/src/js/arrow/lazy-arrow.ts
+++ b/packages/appkit-ui/src/js/arrow/lazy-arrow.ts
@@ -41,15 +41,77 @@ let numericTypeIds: Set | null = null;
let stringTypeIds: Set | null = null;
let decimalTypeId: number | null = null;
+type ArrowTypeEnum = typeof import("apache-arrow").Type;
+type TypeIdKey =
+ | "Date"
+ | "DateDay"
+ | "DateMillisecond"
+ | "Timestamp"
+ | "TimestampSecond"
+ | "TimestampMillisecond"
+ | "TimestampMicrosecond"
+ | "TimestampNanosecond"
+ | "Time"
+ | "TimeSecond"
+ | "TimeMillisecond"
+ | "TimeMicrosecond"
+ | "TimeNanosecond"
+ | "Int"
+ | "Int8"
+ | "Int16"
+ | "Int32"
+ | "Int64"
+ | "Uint8"
+ | "Uint16"
+ | "Uint32"
+ | "Uint64"
+ | "Float"
+ | "Float16"
+ | "Float32"
+ | "Float64"
+ | "Decimal"
+ | "Utf8"
+ | "LargeUtf8";
+
/**
- * Initializes the type ID sets from the Arrow Type enum.
- * Call this after loading the Arrow module.
+ * The Arrow `Type` ids used for field detection. They are part of the Arrow
+ * format, so they are fixed; a test checks them against `apache-arrow`. This
+ * lets detection run on a Table the app built itself, before (or without)
+ * this package ever loading Arrow.
*/
-export async function initializeTypeIdSets(): Promise {
- if (temporalTypeIds !== null) return; // Already initialized
-
- const { Type } = await getArrowModule();
+export const ARROW_TYPE_IDS: Readonly> = {
+ Date: 8,
+ DateDay: -13,
+ DateMillisecond: -14,
+ Timestamp: 10,
+ TimestampSecond: -15,
+ TimestampMillisecond: -16,
+ TimestampMicrosecond: -17,
+ TimestampNanosecond: -18,
+ Time: 9,
+ TimeSecond: -19,
+ TimeMillisecond: -20,
+ TimeMicrosecond: -21,
+ TimeNanosecond: -22,
+ Int: 2,
+ Int8: -2,
+ Int16: -3,
+ Int32: -4,
+ Int64: -5,
+ Uint8: -6,
+ Uint16: -7,
+ Uint32: -8,
+ Uint64: -9,
+ Float: 3,
+ Float16: -10,
+ Float32: -11,
+ Float64: -12,
+ Decimal: 7,
+ Utf8: 5,
+ LargeUtf8: 20,
+};
+function setTypeIdSets(Type: Readonly>): void {
temporalTypeIds = new Set([
Type.Date,
Type.DateDay,
@@ -88,20 +150,38 @@ export async function initializeTypeIdSets(): Promise {
decimalTypeId = Type.Decimal;
}
+/**
+ * Initializes the type ID sets from the Arrow Type enum.
+ * Call this after loading the Arrow module.
+ */
+export async function initializeTypeIdSets(): Promise {
+ if (temporalTypeIds !== null) return; // Already initialized
+
+ const { Type } = await getArrowModule();
+ setTypeIdSets(Type satisfies ArrowTypeEnum);
+}
+
+/**
+ * Initializes the type ID sets synchronously from {@link ARROW_TYPE_IDS} when
+ * they are not set yet. An Arrow Table passed as chart `data` never went
+ * through `processArrowBuffer`, so detection must not depend on it.
+ */
+function ensureTypeIdSets(): void {
+ if (temporalTypeIds === null) setTypeIdSets(ARROW_TYPE_IDS);
+}
+
/**
* Returns the cached type ID sets.
- * Throws if called before initializeTypeIdSets().
- * This is safe because you can't have a Table without first loading Arrow.
+ * Initializes them from the fixed Arrow type ids on first use.
*/
export function getTypeIdSets(): {
temporal: Set;
numeric: Set;
string: Set;
} {
+ ensureTypeIdSets();
if (!temporalTypeIds || !numericTypeIds || !stringTypeIds) {
- throw new Error(
- "Arrow type IDs not initialized. Call initializeTypeIdSets() first.",
- );
+ throw new Error("Arrow type IDs could not be initialized.");
}
return {
temporal: temporalTypeIds,
@@ -111,14 +191,12 @@ export function getTypeIdSets(): {
}
/**
- * Returns the Decimal type ID.
- * Throws if called before initializeTypeIdSets().
+ * Returns the Decimal type ID, initializing the type ids on first use.
*/
export function getDecimalTypeId(): number {
+ ensureTypeIdSets();
if (decimalTypeId === null) {
- throw new Error(
- "Arrow type IDs not initialized. Call initializeTypeIdSets() first.",
- );
+ throw new Error("Arrow type IDs could not be initialized.");
}
return decimalTypeId;
}
diff --git a/packages/appkit-ui/src/react/charts/__tests__/arrow-data.test.ts b/packages/appkit-ui/src/react/charts/__tests__/arrow-data.test.ts
new file mode 100644
index 000000000..060b66871
--- /dev/null
+++ b/packages/appkit-ui/src/react/charts/__tests__/arrow-data.test.ts
@@ -0,0 +1,134 @@
+import {
+ DateDay,
+ Float64,
+ makeVector,
+ Table,
+ Type,
+ tableFromArrays,
+ vectorFromArray,
+} from "apache-arrow";
+import { describe, expect, test } from "vitest";
+
+import { ARROW_TYPE_IDS } from "@/js/arrow/lazy-arrow";
+
+import {
+ NULL_X_LABEL,
+ normalizeChartData,
+ normalizeHeatmapData,
+} from "../normalize";
+
+// This file never calls ArrowClient.processArrowBuffer, like an app that
+// builds its own Table and passes it as `data`.
+describe("Arrow Table as data", () => {
+ test("category rows normalize without prior Arrow initialization", () => {
+ const table = tableFromArrays({
+ region: ["east", "west"],
+ revenue: Float64Array.from([1, 2]),
+ });
+ const n = normalizeChartData(table, "region", "revenue");
+ expect(n.chartType).toBe("categorical");
+ expect(n.xData).toEqual(["east", "west"]);
+ expect(n.yDataMap.revenue).toEqual([1, 2]);
+ });
+
+ test("auto-detection works on an Arrow Table", () => {
+ const table = tableFromArrays({
+ region: ["east", "west"],
+ revenue: Float64Array.from([1, 2]),
+ });
+ const n = normalizeChartData(table);
+ expect(n.xField).toBe("region");
+ expect(n.yFields).toEqual(["revenue"]);
+ });
+
+ test("heatmap still works", () => {
+ const table = tableFromArrays({
+ x: ["a", "b"],
+ y: ["r", "r"],
+ v: Float64Array.from([1, 2]),
+ });
+ expect(normalizeHeatmapData(table, "x", "y", "v").heatmapData).toHaveLength(
+ 2,
+ );
+ });
+
+ test("the fixed type ids match apache-arrow", () => {
+ for (const [name, id] of Object.entries(ARROW_TYPE_IDS)) {
+ expect(Type[name as keyof typeof Type], name).toBe(id);
+ }
+ });
+});
+
+describe("one detection path for Arrow and JSON", () => {
+ const cases: Record[] = [
+ { region: ["east", "west"], revenue: [1, 2] },
+ { period: ["Q1", "Q2"], revenue: [1, 2] },
+ { day: ["2026-01-01", "2026-01-02"], revenue: [1, 2] },
+ {
+ created_at: ["2026-01-01", "2026-01-02"],
+ day: ["2026-02-01", "2026-02-02"],
+ revenue: [1, 2],
+ },
+ { user_id: ["a", "b"], label: ["x", "y"], revenue: [1, 2] },
+ ];
+
+ test.each(cases.map((c) => [Object.keys(c).join(","), c]))(
+ "%s detects the same fields",
+ (_name, columns) => {
+ const cols = columns as Record;
+ const table = tableFromArrays(
+ Object.fromEntries(
+ Object.entries(cols).map(([k, v]) => [
+ k,
+ typeof v[0] === "number" ? Float64Array.from(v as number[]) : v,
+ ]),
+ ) as Parameters[0],
+ );
+ const rows = cols[Object.keys(cols)[0]].map((_, i) =>
+ Object.fromEntries(Object.entries(cols).map(([k, v]) => [k, v[i]])),
+ );
+ const fromArrow = normalizeChartData(table);
+ const fromJson = normalizeChartData(rows);
+ expect(fromArrow.xField).toBe(fromJson.xField);
+ expect(fromArrow.yFields).toEqual(fromJson.yFields);
+ expect(fromArrow.chartType).toBe(fromJson.chartType);
+ },
+ );
+
+ test("a text column named period is not a date in Arrow either", () => {
+ const table = tableFromArrays({
+ period: ["Q1", "Q2"],
+ revenue: Float64Array.from([1, 2]),
+ });
+ expect(normalizeChartData(table).chartType).toBe("categorical");
+ });
+});
+
+describe("Arrow x columns: DATE days and null labels", () => {
+ test("a DATE x column is a date-only time axis at local midnight", () => {
+ const table = new Table({
+ day: makeVector({
+ type: new DateDay(),
+ data: new Int32Array([20454, 20455]),
+ }),
+ revenue: vectorFromArray([1, 2], new Float64()),
+ });
+ const n = normalizeChartData(table, "day", "revenue");
+ expect(n.chartType).toBe("timeseries");
+ expect(n.xDateOnly).toBe(true);
+ expect(n.xData).toEqual([
+ new Date(2026, 0, 1).getTime(),
+ new Date(2026, 0, 2).getTime(),
+ ]);
+ });
+
+ test("a null x is labelled (null), not 0", () => {
+ const table = tableFromArrays({
+ region: ["east", null],
+ revenue: Float64Array.from([1, 2]),
+ });
+ const n = normalizeChartData(table, "region", "revenue");
+ expect(n.xData).toContain(NULL_X_LABEL);
+ expect(n.xData).not.toContain(0);
+ });
+});
diff --git a/packages/appkit-ui/src/react/charts/__tests__/bar-orientation.test.tsx b/packages/appkit-ui/src/react/charts/__tests__/bar-orientation.test.tsx
new file mode 100644
index 000000000..c0aeaa3cf
--- /dev/null
+++ b/packages/appkit-ui/src/react/charts/__tests__/bar-orientation.test.tsx
@@ -0,0 +1,76 @@
+import { cleanup, render, waitFor } from "@testing-library/react";
+import { afterEach, beforeAll, describe, expect, test } from "vitest";
+
+import { BaseChart } from "../base";
+import type { ChartDefaults } from "../types";
+import { chartOption, installEChartsEnv } from "./helpers/echarts-env";
+
+beforeAll(installEChartsEnv);
+afterEach(cleanup);
+
+type AxisOption = { yAxis: { type: string }[] };
+
+async function isHorizontal(
+ data: Record[],
+ xKey: string,
+ defaults?: ChartDefaults,
+): Promise {
+ const { container } = render(
+ ,
+ );
+ await waitFor(() => expect(chartOption(container)).toBeDefined());
+ const horizontal =
+ chartOption(container)?.yAxis[0].type === "category";
+ cleanup();
+ return horizontal;
+}
+
+const segments = ["Retail", "Online", "Partner"].map((segment, i) => ({
+ segment,
+ v: i + 1,
+}));
+const years = [2021, 2022, 2023].map((year, i) => ({ year, v: i + 1 }));
+const manyLabels = Array.from({ length: 9 }, (_, i) => ({
+ segment: `S${i}`,
+ v: i,
+}));
+const longLabels = [
+ { segment: "Consumer Electronics", v: 1 },
+ { segment: "Home", v: 2 },
+];
+const days = [
+ { day: "2026-01-01", v: 1 },
+ { day: "2026-01-02", v: 2 },
+];
+
+describe("bar orientation without the prop", () => {
+ test("today's rule: category labels horizontal, dates vertical", async () => {
+ expect(await isHorizontal(segments, "segment")).toBe(true);
+ expect(await isHorizontal(days, "day")).toBe(false);
+ });
+
+ test("v3: up to 7 short labels are vertical", async () => {
+ expect(await isHorizontal(segments, "segment", "v3")).toBe(false);
+ });
+
+ test("v3: more than 7 labels or long labels are horizontal", async () => {
+ expect(await isHorizontal(manyLabels, "segment", "v3")).toBe(true);
+ expect(await isHorizontal(longLabels, "segment", "v3")).toBe(true);
+ });
+
+ test("v3: dates stay vertical", async () => {
+ expect(await isHorizontal(days, "day", "v3")).toBe(false);
+ });
+});
+
+describe("numeric x such as years", () => {
+ test("v3: years render vertical", async () => {
+ expect(await isHorizontal(years, "year", "v3")).toBe(false);
+ });
+});
diff --git a/packages/appkit-ui/src/react/charts/__tests__/base.test.tsx b/packages/appkit-ui/src/react/charts/__tests__/base.test.tsx
index 05bbb5a63..429c405a1 100644
--- a/packages/appkit-ui/src/react/charts/__tests__/base.test.tsx
+++ b/packages/appkit-ui/src/react/charts/__tests__/base.test.tsx
@@ -109,6 +109,12 @@ const cartesianData = [
{ month: "Mar", revenue: 90, cost: 50 },
];
+const scatterData = [
+ { spend: 10, revenue: 100, cost: 60 },
+ { spend: 20, revenue: 120, cost: 70 },
+ { spend: 30, revenue: 90, cost: 50 },
+];
+
const heatmapData = [
{ day: "Mon", hour: "9am", value: 3 },
{ day: "Mon", hour: "10am", value: 7 },
@@ -122,11 +128,13 @@ describe("BaseChart ECharts registration", () => {
test.each(cartesianTypes)(
"renders %s chart without missing-registration errors",
async (chartType) => {
+ // A scatter needs a numeric x; the others plot months.
+ const isScatter = chartType === "scatter";
const { container } = render(
,
@@ -369,3 +377,380 @@ describe("BaseChart sizing", () => {
expect(root.style.minHeight).toBe("");
});
});
+
+describe("unknown keys", () => {
+ test("a yKey that is not in the rows shows an error with the available keys", () => {
+ const errors: string[] = [];
+ vi.mocked(console.error).mockImplementation((...args: unknown[]) => {
+ errors.push(args.map(String).join(" "));
+ });
+ const { getByRole, container } = render(
+ ,
+ );
+ const alert = getByRole("alert");
+ expect(alert.textContent).toContain('yKey "revnue"');
+ expect(alert.textContent).toContain("Available keys: month, revenue, cost");
+ expect(container.querySelector("canvas")).toBeNull();
+ expect(errors.some((e) => e.includes('yKey "revnue"'))).toBe(true);
+ });
+
+ test("an unknown xKey is reported too", () => {
+ const { getByRole } = render(
+ ,
+ );
+ expect(getByRole("alert").textContent).toContain('xKey "mnth"');
+ });
+});
+
+describe("date-only time axis", () => {
+ test("renders a DATE time axis without uncaught errors", async () => {
+ const { container } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ });
+});
+
+describe("repeated x values", () => {
+ const longRows = [
+ { day: "Mon", region: "east", revenue: 1 },
+ { day: "Mon", region: "west", revenue: 2 },
+ { day: "Tue", region: "east", revenue: 3 },
+ ];
+
+ test("warns and points at seriesKey", () => {
+ render(
+ ,
+ );
+ expect(
+ vi
+ .mocked(console.warn)
+ .mock.calls.some((c) => String(c[0]).includes("pass seriesKey")),
+ ).toBe(true);
+ });
+
+ test("no warning with seriesKey", () => {
+ render(
+ ,
+ );
+ expect(
+ vi
+ .mocked(console.warn)
+ .mock.calls.some((c) => String(c[0]).includes("pass seriesKey")),
+ ).toBe(false);
+ });
+});
+
+describe("radar options", () => {
+ test("a partial radar option keeps the metric list and renders", async () => {
+ const pageErrors: unknown[] = [];
+ const onError = (e: ErrorEvent) => pageErrors.push(e.error);
+ window.addEventListener("error", onError);
+ const { container } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ window.removeEventListener("error", onError);
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ const option = echarts.getInstanceByDom(root)?.getOption() as {
+ radar: { indicator: { name: string }[]; splitNumber: number }[];
+ };
+ expect(option.radar[0].indicator.map((i) => i.name)).toEqual([
+ "Speed",
+ "Power",
+ "Range",
+ ]);
+ expect(option.radar[0].splitNumber).toBe(4);
+ expect(pageErrors).toEqual([]);
+ });
+});
+
+describe("updates after mount", () => {
+ test("series removed from yKey leave the chart", async () => {
+ const { container, rerender } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ rerender(
+ ,
+ );
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ await waitFor(() => {
+ const option = echarts.getInstanceByDom(root)?.getOption() as {
+ series: unknown[];
+ legend?: unknown[];
+ };
+ expect(option.series).toHaveLength(1);
+ expect(option.legend ?? []).toHaveLength(0);
+ });
+ });
+});
+
+describe("rebuilding the option keeps the reader's zoom and legend", () => {
+ test("a zoomed range survives an option rebuild", async () => {
+ const { container, rerender } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ const chart = echarts.getInstanceByDom(root);
+ chart?.dispatchAction({ type: "dataZoom", start: 20, end: 60 });
+ rerender(
+ ,
+ );
+ await waitFor(() => {
+ const option = chart?.getOption() as {
+ title: { text: string }[];
+ dataZoom: { start: number; end: number }[];
+ };
+ expect(option.title[0].text).toBe("second");
+ expect(option.dataZoom[0]).toMatchObject({ start: 20, end: 60 });
+ });
+ });
+
+ test("a legend entry the reader hid stays hidden after a rebuild", async () => {
+ const { container, rerender } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ const chart = echarts.getInstanceByDom(root);
+ chart?.dispatchAction({ type: "legendToggleSelect", name: "Cost" });
+ rerender(
+ ,
+ );
+ await waitFor(() => {
+ const option = chart?.getOption() as {
+ title: { text: string }[];
+ legend: { selected: Record }[];
+ };
+ expect(option.title[0].text).toBe("second");
+ expect(option.legend[0].selected.Cost).toBe(false);
+ expect(option.legend[0].selected.Revenue).toBe(true);
+ });
+ });
+});
+
+describe("scatter with text x", () => {
+ test("shows an error instead of an empty plot", () => {
+ const errors: string[] = [];
+ vi.mocked(console.error).mockImplementation((...args: unknown[]) => {
+ errors.push(args.map(String).join(" "));
+ });
+ const { getByRole, container } = render(
+ ,
+ );
+ expect(getByRole("alert").textContent).toContain(
+ 'xKey "customer" holds text',
+ );
+ expect(container.querySelector("canvas")).toBeNull();
+ expect(errors.some((e) => e.includes("holds text"))).toBe(true);
+ });
+
+ test("numeric x still renders", async () => {
+ const { container, queryByRole } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ expect(queryByRole("alert")).toBeNull();
+ });
+});
+
+describe("scatter over dates", () => {
+ test("plots DATE strings on a time axis", async () => {
+ const { container } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ const option = echarts.getInstanceByDom(root)?.getOption() as {
+ xAxis: { type: string }[];
+ series: { data: [number, number][] }[];
+ };
+ expect(option.xAxis[0].type).toBe("time");
+ expect(option.series[0].data[0][0]).toBe(new Date(2026, 0, 1).getTime());
+ });
+});
+
+describe("reference lines", () => {
+ test.each([
+ ["line", undefined],
+ ["bar", "horizontal"],
+ ] as const)(
+ "%s %s draws a labelled markLine",
+ async (chartType, orientation) => {
+ const { container } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ const root = container.querySelector(
+ "[_echarts_instance_]",
+ ) as HTMLElement;
+ const option = echarts.getInstanceByDom(root)?.getOption() as {
+ series: { markLine?: { data: Record[] } }[];
+ };
+ const line = option.series[0].markLine?.data[0];
+ expect(line?.[orientation ? "xAxis" : "yAxis"]).toBe(100);
+ expect((line?.label as { formatter: string }).formatter).toBe("Target");
+ expect(registrationErrors).toEqual([]);
+ },
+ );
+});
+
+describe("zoom", () => {
+ test("adds inside and slider zoom along x without registration errors", async () => {
+ const { container } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ const option = echarts.getInstanceByDom(root)?.getOption() as {
+ dataZoom: { type: string; xAxisIndex: number[] }[];
+ };
+ expect(option.dataZoom.map((z) => z.type).sort()).toEqual([
+ "inside",
+ "slider",
+ ]);
+ expect(registrationErrors).toEqual([]);
+ });
+
+ test("no zoom by default", async () => {
+ const { container } = render(
+ ,
+ );
+ await waitFor(() =>
+ expect(container.querySelector("canvas")).not.toBeNull(),
+ );
+ const root = container.querySelector("[_echarts_instance_]") as HTMLElement;
+ const option = echarts.getInstanceByDom(root)?.getOption() as {
+ dataZoom?: unknown[];
+ };
+ expect(option.dataZoom ?? []).toHaveLength(0);
+ });
+});
diff --git a/packages/appkit-ui/src/react/charts/__tests__/cartesian-options.test.ts b/packages/appkit-ui/src/react/charts/__tests__/cartesian-options.test.ts
new file mode 100644
index 000000000..f42d79075
--- /dev/null
+++ b/packages/appkit-ui/src/react/charts/__tests__/cartesian-options.test.ts
@@ -0,0 +1,1302 @@
+import { describe, expect, test } from "vitest";
+
+import {
+ applySelectionEmphasis,
+ buildCartesianOption,
+ buildHorizontalBarOption,
+ type CartesianContext,
+ mergeChartOptions,
+} from "../options";
+
+type Series = Record;
+type Option = { series: Series[]; [key: string]: unknown };
+
+function cartesian(overrides: Partial = {}): Option {
+ return buildCartesianOption({
+ xData: ["A", "B", "C"],
+ yDataMap: { a: [1, 2, 3], b: [4, 5, 6] },
+ yFields: ["a", "b"],
+ colors: ["#ff0000", "#00ff00"],
+ showLegend: true,
+ chartType: "bar",
+ isTimeSeries: false,
+ stacked: false,
+ smooth: false,
+ showSymbol: false,
+ symbolSize: 8,
+ ...overrides,
+ }) as Option;
+}
+
+describe("vertical stacked bars", () => {
+ test("stacked applies a stack to vertical bar series", () => {
+ const option = cartesian({ stacked: true });
+ expect(option.series.map((s) => s.stack)).toEqual(["total", "total"]);
+ });
+
+ test("unstacked bars have no stack", () => {
+ const option = cartesian();
+ expect(option.series.map((s) => s.stack)).toEqual([undefined, undefined]);
+ });
+});
+
+describe("horizontal bar row order", () => {
+ const ctx = {
+ xData: ["Big", "Mid", "Small"],
+ yDataMap: { v: [30, 20, 10] },
+ yFields: ["v"],
+ colors: ["#ff0000"],
+ showLegend: false,
+ };
+
+ test("v3 puts the first row on top", () => {
+ const option = buildHorizontalBarOption({ ...ctx, v3: true }, false) as {
+ yAxis: { inverse?: boolean };
+ };
+ expect(option.yAxis.inverse).toBe(true);
+ });
+
+ test("without v3 the axis is unchanged", () => {
+ const option = buildHorizontalBarOption(ctx, false) as {
+ yAxis: { inverse?: boolean };
+ };
+ expect(option.yAxis.inverse).toBeUndefined();
+ });
+});
+
+describe("category labels sized by width", () => {
+ const labels = Array.from(
+ { length: 12 },
+ (_, i) => `Consumer Electronics ${i}`,
+ );
+ const yDataMap = { a: labels.map((_, i) => i) };
+
+ test("with a measured width every label is drawn and truncated to its slot", () => {
+ const option = cartesian({
+ xData: labels.slice(0, 5),
+ yDataMap: { a: [1, 2, 3, 4, 5] },
+ yFields: ["a"],
+ chartWidth: 800,
+ }) as unknown as { xAxis: { axisLabel: Record } };
+ expect(option.xAxis.axisLabel).toMatchObject({
+ interval: 0,
+ width: 120,
+ overflow: "truncate",
+ });
+ expect(option.xAxis.axisLabel.formatter).toBeUndefined();
+ });
+
+ test("narrow slots rotate the labels", () => {
+ const option = cartesian({
+ xData: labels,
+ yDataMap,
+ yFields: ["a"],
+ chartWidth: 400,
+ }) as unknown as { xAxis: { axisLabel: Record } };
+ expect(option.xAxis.axisLabel).toMatchObject({
+ rotate: 45,
+ overflow: "truncate",
+ });
+ });
+
+ test("horizontal bar labels get a share of the width", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: labels,
+ yDataMap,
+ yFields: ["a"],
+ colors: ["#ff0000"],
+ showLegend: false,
+ chartWidth: 600,
+ },
+ false,
+ ) as { yAxis: { axisLabel: Record } };
+ expect(option.yAxis.axisLabel).toMatchObject({
+ width: 180,
+ overflow: "truncate",
+ });
+ expect(option.yAxis.axisLabel.formatter).toBeUndefined();
+ });
+
+ test("without a width labels keep the character cut", () => {
+ const option = cartesian({
+ xData: labels.slice(0, 2),
+ yDataMap: { a: [1, 2] },
+ yFields: ["a"],
+ }) as unknown as {
+ xAxis: { axisLabel: { formatter: (v: string) => string } };
+ };
+ expect(option.xAxis.axisLabel.formatter("Consumer Electronics")).toBe(
+ "Consumer E...",
+ );
+ });
+});
+
+describe("axis names", () => {
+ type Axes = {
+ xAxis: Record;
+ yAxis: Record;
+ };
+
+ test("today: names at the axis end", () => {
+ const option = cartesian({ yFields: ["a"] }) as unknown as Axes;
+ expect(option.xAxis.name).toBeUndefined();
+ const withField = cartesian({
+ yFields: ["a"],
+ xField: "segment",
+ }) as unknown as Axes;
+ expect(withField.xAxis.name).toBe("Segment");
+ expect(withField.yAxis.name).toBe("A");
+ });
+
+ test("v3: no axis names on bar, line and area", () => {
+ const option = cartesian({
+ yFields: ["a"],
+ xField: "segment",
+ v3: true,
+ }) as unknown as Axes;
+ expect(option.xAxis).not.toHaveProperty("name");
+ expect(option.yAxis).not.toHaveProperty("name");
+ });
+
+ test("v3: scatter keeps centred axis names", () => {
+ const option = cartesian({
+ chartType: "scatter",
+ xData: [1, 2],
+ yDataMap: { a: [3, 4] },
+ yFields: ["a"],
+ xField: "spend",
+ v3: true,
+ }) as unknown as Axes;
+ expect(option.xAxis).toMatchObject({
+ name: "Spend",
+ nameLocation: "middle",
+ });
+ expect(option.yAxis).toMatchObject({ name: "A", nameLocation: "middle" });
+ });
+});
+
+describe("horizontal bar grid", () => {
+ test("reserves label space with pixel margins", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A", "B"],
+ yDataMap: { a: [1, 2] },
+ yFields: ["a"],
+ colors: ["#ff0000"],
+ showLegend: true,
+ },
+ false,
+ ) as { grid: Record };
+ expect(option.grid).toEqual({
+ left: 8,
+ right: 24,
+ top: 12,
+ bottom: 8,
+ containLabel: true,
+ });
+ });
+});
+
+describe("bars over dates", () => {
+ const days = [
+ Date.UTC(2026, 0, 1),
+ Date.UTC(2026, 0, 2),
+ Date.UTC(2026, 0, 3),
+ ].map((t) => new Date(t).setHours(0, 0, 0, 0));
+
+ test("use a category axis of formatted dates with one label per bar", () => {
+ const option = cartesian({
+ xData: days,
+ yDataMap: { a: [1, 2, 3] },
+ yFields: ["a"],
+ isTimeSeries: true,
+ xDateOnly: true,
+ }) as unknown as {
+ xAxis: {
+ type: string;
+ data: number[];
+ axisLabel: { formatter: (v: number) => string };
+ };
+ series: { data: unknown[] }[];
+ };
+ expect(option.xAxis.type).toBe("category");
+ expect(option.xAxis.data).toEqual(days);
+ expect(option.xAxis.axisLabel.formatter(days[0])).toBe("2026-01-01");
+ expect(option.series[0].data).toEqual([1, 2, 3]);
+ });
+
+ test("lines over dates keep the time axis", () => {
+ const option = cartesian({
+ chartType: "line",
+ xData: days,
+ yDataMap: { a: [1, 2, 3] },
+ yFields: ["a"],
+ isTimeSeries: true,
+ }) as unknown as { xAxis: { type: string } };
+ expect(option.xAxis.type).toBe("time");
+ });
+});
+
+describe("selection that matches nothing, and date bars", () => {
+ const bars = {
+ xAxis: { type: "category", data: ["East", "West"] },
+ series: [{ type: "bar", data: [1, 2] }],
+ };
+
+ test("a selected name not in the data leaves the chart undimmed", () => {
+ expect(applySelectionEmphasis(bars, "North")).toBe(bars);
+ });
+
+ test("a matching name still dims the rest", () => {
+ const out = applySelectionEmphasis(bars, "West") as unknown as {
+ series: { data: { itemStyle: { opacity: number } }[] }[];
+ };
+ expect(out.series[0].data.map((d) => d.itemStyle.opacity)).toEqual([
+ 0.3, 1,
+ ]);
+ });
+
+ test("a date selection matches bars over dates", () => {
+ const jan1 = new Date(2026, 0, 1).getTime();
+ const jan2 = new Date(2026, 0, 2).getTime();
+ const dateBars = {
+ xAxis: { type: "category", data: [jan1, jan2] },
+ series: [{ type: "bar", data: [1, 2] }],
+ };
+ const out = applySelectionEmphasis(dateBars, "2026-01-02") as unknown as {
+ series: { data: { itemStyle: { opacity: number } }[] }[];
+ };
+ expect(out.series[0].data.map((d) => d.itemStyle.opacity)).toEqual([
+ 0.3, 1,
+ ]);
+ });
+
+ test("a pie selection not in the slices leaves the pie undimmed", () => {
+ const pie = {
+ series: [{ type: "pie", data: [{ name: "A", value: 1 }] }],
+ };
+ expect(applySelectionEmphasis(pie, "Z")).toBe(pie);
+ });
+});
+
+describe("a single data point", () => {
+ test("line and area show the symbol of a one-point series", () => {
+ for (const chartType of ["line", "area"] as const) {
+ const option = cartesian({
+ chartType,
+ xData: ["Jan"],
+ yDataMap: { a: [5] },
+ yFields: ["a"],
+ });
+ expect(option.series[0].showSymbol).toBe(true);
+ }
+ });
+
+ test("a series with several points keeps showSymbol off", () => {
+ const option = cartesian({ chartType: "line", yFields: ["a"] });
+ expect(option.series[0].showSymbol).toBe(false);
+ });
+
+ test("a single date pads the time axis by a day", () => {
+ const day = new Date(2026, 0, 1).getTime();
+ const option = cartesian({
+ chartType: "line",
+ xData: [day],
+ yDataMap: { a: [5] },
+ yFields: ["a"],
+ isTimeSeries: true,
+ xDateOnly: true,
+ }) as unknown as { xAxis: Record };
+ expect(option.xAxis.min).toBe(day - 86400000);
+ expect(option.xAxis.max).toBe(day + 86400000);
+ expect(option.xAxis.minInterval).toBe(86400000);
+ });
+
+ test("a single bar is capped in width", () => {
+ const option = cartesian({
+ xData: ["Only"],
+ yDataMap: { a: [5] },
+ yFields: ["a"],
+ });
+ expect(option.series[0].barMaxWidth).toBe(80);
+ });
+});
+
+describe("scatter axes and tooltip", () => {
+ const scatter = () =>
+ cartesian({
+ chartType: "scatter",
+ xData: [5000, 5500, 6000],
+ yDataMap: { uptime_pct: [97, 98.5, 99.5] },
+ yFields: ["uptime_pct"],
+ xField: "monthly_spend",
+ }) as unknown as {
+ xAxis: { scale?: boolean };
+ yAxis: { scale?: boolean };
+ tooltip: { formatter: (p: unknown) => string };
+ };
+
+ test("both axes fit the data", () => {
+ const option = scatter();
+ expect(option.xAxis.scale).toBe(true);
+ expect(option.yAxis.scale).toBe(true);
+ });
+
+ test("the tooltip shows both fields", () => {
+ const text = scatter().tooltip.formatter({
+ seriesName: "Uptime Pct",
+ seriesIndex: 0,
+ value: [5500, 98.5],
+ });
+ expect(text).toContain("5500");
+ expect(text).toContain("98.5");
+ expect(text).toMatch(/Monthly Spend: 5500/);
+ });
+
+ test("bar value axes still start at 0", () => {
+ const option = cartesian() as unknown as { yAxis: { scale?: boolean } };
+ expect(option.yAxis.scale).toBeUndefined();
+ });
+});
+
+describe("scatter point opacity", () => {
+ const opacityFor = (count: number) => {
+ const xs = Array.from({ length: count }, (_, i) => i);
+ const option = cartesian({
+ chartType: "scatter",
+ xData: xs,
+ yDataMap: { a: xs },
+ yFields: ["a"],
+ });
+ return (option.series[0].itemStyle as { opacity: number }).opacity;
+ };
+
+ test("falls as the point count grows", () => {
+ expect(opacityFor(20)).toBe(0.8);
+ expect(opacityFor(200)).toBe(0.6);
+ expect(opacityFor(2000)).toBe(0.35);
+ expect(opacityFor(10000)).toBe(0.2);
+ });
+});
+
+describe("value labels", () => {
+ type Label = {
+ show: boolean;
+ position: string;
+ formatter: (p: { value: unknown }) => string;
+ };
+
+ test("bars print their values on top", () => {
+ const option = cartesian({ yFields: ["a"], showValues: true });
+ const label = option.series[0].label as Label;
+ expect(label.position).toBe("top");
+ expect(label.formatter({ value: 3 })).toBe("3");
+ });
+
+ test("stacked bars print inside, formatted like the axis", () => {
+ const option = cartesian({
+ showValues: true,
+ stacked: true,
+ axisValueFormatter: (v) => `${v} pts`,
+ });
+ const label = option.series[0].label as Label;
+ expect(label.position).toBe("inside");
+ expect(label.formatter({ value: 4 })).toBe("4 pts");
+ });
+
+ test("scatter points print y", () => {
+ const option = cartesian({
+ chartType: "scatter",
+ xData: [1, 2],
+ yDataMap: { a: [3, 4] },
+ yFields: ["a"],
+ showValues: true,
+ });
+ expect((option.series[0].label as Label).formatter({ value: [1, 3] })).toBe(
+ "3",
+ );
+ });
+
+ test("off by default and never on lines", () => {
+ expect(cartesian().series[0].label).toBeUndefined();
+ expect(
+ cartesian({ chartType: "line", showValues: true }).series[0].label,
+ ).toBeUndefined();
+ });
+
+ test("horizontal bars print to the right", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A"],
+ yDataMap: { a: [1] },
+ yFields: ["a"],
+ colors: ["#ff0000"],
+ showLegend: false,
+ showValues: true,
+ },
+ false,
+ ) as { series: { label: Label }[] };
+ expect(option.series[0].label.position).toBe("right");
+ });
+});
+
+describe("combo charts and a second y axis", () => {
+ test("a yKey drawn as a line on the right axis", () => {
+ const option = cartesian({
+ yFields: ["revenue", "margin_pct"],
+ yDataMap: { revenue: [100, 200, 300], margin_pct: [10, 12, 9] },
+ seriesConfig: { margin_pct: { type: "line", axis: "right" } },
+ }) as unknown as {
+ yAxis: Record[];
+ series: Record[];
+ };
+ expect(option.yAxis).toHaveLength(2);
+ expect(option.yAxis[1]).toMatchObject({
+ type: "value",
+ position: "right",
+ splitLine: { show: false },
+ });
+ expect(option.series[0]).toMatchObject({ type: "bar" });
+ expect(option.series[0]).not.toHaveProperty("yAxisIndex");
+ expect(option.series[1]).toMatchObject({
+ type: "line",
+ yAxisIndex: 1,
+ smooth: false,
+ });
+ });
+
+ test("without series config there is one value axis", () => {
+ const option = cartesian() as unknown as { yAxis: unknown };
+ expect(Array.isArray(option.yAxis)).toBe(false);
+ });
+
+ test("stacked bars stack per axis when series are configured", () => {
+ const option = cartesian({
+ stacked: true,
+ seriesConfig: { b: { axis: "left" } },
+ });
+ expect(option.series.map((s) => s.stack)).toEqual(["bar-left", "bar-left"]);
+ });
+});
+
+describe("reference lines widen the value axis", () => {
+ type Range = {
+ max?: (e: { min: number; max: number }) => number | undefined;
+ min?: (e: { min: number; max: number }) => number | undefined;
+ };
+ const yAxis = (o: Option) => o.yAxis as unknown as Range;
+
+ test("a line above the data raises the axis max past the line", () => {
+ const option = cartesian({ referenceLines: [{ value: 110 }] });
+ expect(yAxis(option).max?.({ min: 0, max: 98 })).toBe(120);
+ });
+
+ test("a line inside the data leaves the max to ECharts", () => {
+ const option = cartesian({ referenceLines: [{ value: 40 }] });
+ expect(yAxis(option).max?.({ min: 0, max: 98 })).toBeUndefined();
+ });
+
+ test("a line below zero lowers the min; bars still start at zero", () => {
+ const option = cartesian({ referenceLines: [{ value: -20 }] });
+ expect(yAxis(option).min?.({ min: 5, max: 98 })).toBeLessThan(-20);
+ const inside = cartesian({ referenceLines: [{ value: 3 }] });
+ expect(yAxis(inside).min?.({ min: 5, max: 98 })).toBeUndefined();
+ });
+
+ test("a line just under a positive data minimum keeps its place in the axis", () => {
+ const option = cartesian({
+ chartType: "scatter",
+ referenceLines: [{ value: 7.9 }],
+ });
+ const min = yAxis(option).min?.({ min: 8, max: 8.5 });
+ expect(min).toBeDefined();
+ expect(min as number).toBeLessThanOrEqual(7.9);
+ });
+
+ test("without reference lines the axis has no min or max", () => {
+ expect(yAxis(cartesian()).max).toBeUndefined();
+ });
+
+ test("horizontal bars widen the x axis", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A"],
+ yDataMap: { v: [50] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ referenceLines: [{ value: 400 }],
+ },
+ false,
+ ) as unknown as { xAxis: Range };
+ expect(option.xAxis.max?.({ min: 0, max: 50 })).toBeGreaterThan(400);
+ });
+});
+
+describe("title width", () => {
+ type Title = { textStyle: { width?: number; overflow?: string } };
+
+ test("a title is truncated to the card width", () => {
+ const option = cartesian({ title: "A very long title", chartWidth: 280 });
+ const title = option.title as unknown as Title;
+ expect(title.textStyle.width).toBe(280 - 32);
+ expect(title.textStyle.overflow).toBe("truncate");
+ });
+
+ test("an unmeasured chart keeps the plain title", () => {
+ const title = cartesian({ title: "T" }).title as unknown as Title;
+ expect(title.textStyle.width).toBeUndefined();
+ });
+});
+
+describe("room for the title", () => {
+ const top = (o: Option) => (o.grid as { top: unknown }).top;
+
+ test("a short chart reserves at least 44 px for the title", () => {
+ expect(top(cartesian({ title: "T", chartHeight: 200 }))).toBe(44);
+ });
+
+ test("a tall chart keeps 15% of the height", () => {
+ expect(top(cartesian({ title: "T", chartHeight: 400 }))).toBe(60);
+ });
+
+ test("without a measured height the old share is kept", () => {
+ expect(top(cartesian({ title: "T" }))).toBe("15%");
+ });
+});
+
+describe("series legend width", () => {
+ type Legend = {
+ width?: number;
+ textStyle: { width?: number; overflow?: string };
+ };
+
+ test("a measured legend is bounded and truncates long names", () => {
+ const legend = cartesian({ chartWidth: 400 }).legend as unknown as Legend;
+ expect(legend.width).toBe(352);
+ expect(legend.textStyle.width).toBe(140);
+ expect(legend.textStyle.overflow).toBe("truncate");
+ });
+
+ test("an unmeasured legend is unchanged", () => {
+ const legend = cartesian().legend as unknown as Legend;
+ expect(legend.width).toBeUndefined();
+ expect(legend.textStyle.width).toBeUndefined();
+ });
+});
+
+describe("rotated category labels", () => {
+ const axisLabel = (o: Option) =>
+ (o.xAxis as { axisLabel: Record }).axisLabel;
+ const many = Array.from({ length: 100 }, (_, i) => `Category ${i}`);
+
+ test("rotated labels hide the ones that would overlap", () => {
+ const option = cartesian({
+ xData: many,
+ yDataMap: { a: many.map((_, i) => i) },
+ yFields: ["a"],
+ chartWidth: 600,
+ });
+ expect(axisLabel(option)).toMatchObject({
+ rotate: 45,
+ hideOverlap: true,
+ });
+ });
+
+ test("upright labels keep every label", () => {
+ const option = cartesian({ chartWidth: 600 });
+ expect(axisLabel(option).hideOverlap).toBeUndefined();
+ });
+});
+
+describe("reference line labels", () => {
+ type MarkLine = { data: { label: { position?: string } }[] };
+ const positions = (o: Option) =>
+ (o.series[0].markLine as MarkLine).data.map((d) => d.label.position);
+
+ test("v3: two close lines put their labels on opposite sides", () => {
+ const option = cartesian({
+ v3: true,
+ referenceLines: [
+ { value: 1000, label: "SLO" },
+ { value: 1040, label: "Alert" },
+ ],
+ });
+ expect(positions(option)).toEqual(["insideEndBottom", "insideEndTop"]);
+ });
+
+ test("v3: one line keeps its label above it", () => {
+ const option = cartesian({ v3: true, referenceLines: [{ value: 5 }] });
+ expect(positions(option)).toEqual(["insideEndTop"]);
+ });
+
+ test("without v3 the labels are not staggered", () => {
+ const option = cartesian({
+ referenceLines: [{ value: 1 }, { value: 2 }],
+ });
+ expect(positions(option)).toEqual([undefined, undefined]);
+ });
+});
+
+describe("unlabelled reference line format", () => {
+ type MarkLine = { data: { label: { formatter: string } }[] };
+ const formatted = (o: Option) =>
+ (o.series[0].markLine as MarkLine).data[0].label.formatter;
+
+ test("a line without a label uses the axis format, not the tooltip format", () => {
+ const option = cartesian({
+ referenceLines: [{ value: 30000000 }],
+ valueFormatter: (v) => "full " + v,
+ axisValueFormatter: (v) => "short " + v,
+ });
+ expect(formatted(option)).toBe("short 30000000");
+ });
+
+ test("a user valueFormatter still applies when there is no axis format", () => {
+ const option = cartesian({
+ referenceLines: [{ value: 5 }],
+ valueFormatter: (v) => "#" + v,
+ });
+ expect(formatted(option)).toBe("#5");
+ });
+});
+
+describe("value axis ticks", () => {
+ test("value axis labels hide ticks that overlap", () => {
+ const option = cartesian({ valueFormatter: (v) => "$" + v });
+ expect(
+ (option.yAxis as { axisLabel: { hideOverlap?: boolean } }).axisLabel,
+ ).toMatchObject({
+ hideOverlap: true,
+ });
+ });
+
+ test("horizontal bars hide overlapping x ticks too", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A"],
+ yDataMap: { v: [1] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ },
+ false,
+ ) as unknown as { xAxis: { axisLabel: { hideOverlap?: boolean } } };
+ expect(option.xAxis.axisLabel.hideOverlap).toBe(true);
+ });
+});
+
+describe("horizontal bar combo series", () => {
+ const build = (seriesConfig?: Record) =>
+ buildHorizontalBarOption(
+ {
+ xData: ["A", "B"],
+ yDataMap: { revenue: [500000, 400000], margin_pct: [20, 30] },
+ yFields: ["revenue", "margin_pct"],
+ colors: ["#f00", "#0f0"],
+ showLegend: true,
+ seriesConfig,
+ },
+ false,
+ ) as unknown as {
+ xAxis: unknown;
+ series: { type: string; xAxisIndex?: number }[];
+ };
+
+ test("a line series on the right axis uses a second x axis on top", () => {
+ const option = build({ margin_pct: { type: "line", axis: "right" } });
+ expect(option.series.map((s) => s.type)).toEqual(["bar", "line"]);
+ expect(option.series[1].xAxisIndex).toBe(1);
+ expect(option.xAxis).toHaveLength(2);
+ expect((option.xAxis as { position?: string }[])[1].position).toBe("top");
+ });
+
+ test("without series config every series is a bar on one axis", () => {
+ const option = build();
+ expect(option.series.map((s) => s.type)).toEqual(["bar", "bar"]);
+ expect(Array.isArray(option.xAxis)).toBe(false);
+ });
+});
+
+describe("daily bars over two years", () => {
+ const days = Array.from({ length: 730 }, (_, i) => 1735689600000 + i * 864e5);
+ const daily = (chartWidth: number) =>
+ cartesian({
+ xData: days,
+ yDataMap: { a: days.map((_, i) => i) },
+ yFields: ["a"],
+ isTimeSeries: true,
+ xDateOnly: true,
+ chartWidth,
+ }) as unknown as { xAxis: { axisLabel: Record } };
+
+ test("labels are thinned to every nth date, upright", () => {
+ const label = daily(900).xAxis.axisLabel;
+ expect(label.interval).toBe(Math.ceil(72 / ((900 * 0.8) / 730)) - 1);
+ expect(label).toMatchObject({ rotate: 0, hideOverlap: true });
+ });
+
+ test("a few dates keep the regular category labels", () => {
+ const few = cartesian({
+ xData: days.slice(0, 5),
+ yDataMap: { a: [1, 2, 3, 4, 5] },
+ yFields: ["a"],
+ isTimeSeries: true,
+ xDateOnly: true,
+ chartWidth: 900,
+ }) as unknown as { xAxis: { axisLabel: Record } };
+ expect(few.xAxis.axisLabel.interval).toBe(0);
+ });
+});
+
+describe("overlapping value labels on bars", () => {
+ test("showValues hides labels that overlap", () => {
+ const option = cartesian({ showValues: true });
+ expect(option.series.map((s) => s.labelLayout)).toEqual([
+ { hideOverlap: true },
+ { hideOverlap: true },
+ ]);
+ });
+
+ test("horizontal bars hide overlapping labels too", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A"],
+ yDataMap: { v: [1] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ showValues: true,
+ },
+ false,
+ ) as unknown as { series: { labelLayout?: unknown }[] };
+ expect(option.series[0].labelLayout).toEqual({ hideOverlap: true });
+ });
+
+ test("no labelLayout without showValues", () => {
+ expect(cartesian().series[0].labelLayout).toBeUndefined();
+ });
+});
+
+describe("labels of negative bars", () => {
+ const data = (o: Option) => o.series[0].data as unknown[];
+
+ test("a negative bar's label goes below its end", () => {
+ const option = cartesian({
+ showValues: true,
+ yFields: ["a"],
+ yDataMap: { a: [5, -3, 0] },
+ });
+ expect(data(option)[1]).toMatchObject({
+ value: -3,
+ label: { position: "bottom" },
+ });
+ expect(data(option)[0]).toBe(5);
+ });
+
+ test("without showValues no label is set", () => {
+ const option = cartesian({ yFields: ["a"], yDataMap: { a: [5, -3, 0] } });
+ expect(data(option)[1]).not.toHaveProperty("label");
+ });
+
+ test("stacked labels sit inside, no label position per item", () => {
+ const option = cartesian({
+ showValues: true,
+ stacked: true,
+ yDataMap: { a: [5, -3, 0], b: [1, 2, 3] },
+ });
+ expect(data(option)[1]).not.toHaveProperty("label");
+ });
+
+ test("horizontal negative bars put the label on the left", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A", "B"],
+ yDataMap: { v: [4, -4] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ showValues: true,
+ },
+ false,
+ ) as unknown as { series: { data: unknown[] }[] };
+ expect(option.series[0].data[1]).toMatchObject({
+ value: -4,
+ label: { position: "left" },
+ });
+ });
+});
+
+describe("value labels at the right edge", () => {
+ const grid = (showValues: boolean, stacked = false) =>
+ (
+ buildHorizontalBarOption(
+ {
+ xData: ["A", "B"],
+ yDataMap: { v: [7450000, 12] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ showValues,
+ valueFormatter: (v) => "$" + Number(v).toLocaleString("en-US"),
+ },
+ stacked,
+ ) as unknown as { grid: { right: number } }
+ ).grid;
+
+ test("the right margin fits the widest label", () => {
+ expect(grid(true).right).toBe("$7,450,000".length * 7 + 8);
+ });
+
+ test("without showValues the margin is 24", () => {
+ expect(grid(false).right).toBe(24);
+ });
+
+ test("stacked labels sit inside, margin stays 24", () => {
+ expect(grid(true, true).right).toBe(24);
+ });
+});
+
+describe("horizontal bar row labels", () => {
+ test("row labels hide the ones that overlap", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A", "B"],
+ yDataMap: { v: [1, 2] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ chartWidth: 400,
+ },
+ false,
+ ) as unknown as { yAxis: { axisLabel: { hideOverlap?: boolean } } };
+ expect(option.yAxis.axisLabel.hideOverlap).toBe(true);
+ });
+});
+
+describe("time axis tick labels", () => {
+ test("a time axis hides labels that overlap", () => {
+ const option = cartesian({
+ chartType: "line",
+ isTimeSeries: true,
+ xData: [1735689600000, 1735776000000],
+ yFields: ["a"],
+ yDataMap: { a: [1, 2] },
+ }) as unknown as { xAxis: { type: string; axisLabel: object } };
+ expect(option.xAxis.type).toBe("time");
+ expect(option.xAxis.axisLabel).toMatchObject({
+ show: true,
+ hideOverlap: true,
+ });
+ });
+
+ test("a category axis is not affected", () => {
+ const label = (
+ cartesian().xAxis as { axisLabel: { hideOverlap?: boolean } }
+ ).axisLabel;
+ expect(label.hideOverlap).toBeUndefined();
+ });
+});
+
+describe("scatter point labels", () => {
+ test("showValues on a scatter hides overlapping labels", () => {
+ const option = cartesian({
+ chartType: "scatter",
+ showValues: true,
+ xData: [1, 2, 3],
+ yFields: ["a"],
+ yDataMap: { a: [1, 2, 3] },
+ });
+ expect(option.series[0].labelLayout).toEqual({ hideOverlap: true });
+ });
+});
+
+describe("scatter x ticks", () => {
+ const scatter = (xs: number[]) =>
+ cartesian({
+ chartType: "scatter",
+ xData: xs,
+ xField: "seats",
+ yFields: ["a"],
+ yDataMap: { a: xs.map(() => 1) },
+ axisValueFormatter: (v) => "c" + v,
+ }) as unknown as {
+ xAxis: { axisLabel: { formatter?: (v: number) => string } };
+ };
+
+ test("large x values get the compact axis format", () => {
+ expect(scatter([1000000, 9000000]).xAxis.axisLabel.formatter?.(2e6)).toBe(
+ "c2000000",
+ );
+ });
+
+ test("small x values (years) keep their digits", () => {
+ expect(scatter([2019, 2024]).xAxis.axisLabel.formatter).toBeUndefined();
+ });
+});
+
+describe("scatter x axis name and legend", () => {
+ const scatter = (yFields: string[]) =>
+ cartesian({
+ chartType: "scatter",
+ v3: true,
+ xData: [1, 2],
+ xField: "seats",
+ yFields,
+ yDataMap: Object.fromEntries(yFields.map((f) => [f, [1, 2]])),
+ }) as unknown as { grid: { bottom: unknown } };
+
+ test("the name gets its own band above the legend row", () => {
+ expect(scatter(["a", "b"]).grid.bottom).toBe(36 + 40);
+ });
+
+ test("without a legend the name still has room", () => {
+ expect(scatter(["a"]).grid.bottom).toBe(40);
+ });
+});
+
+describe("scatter y axis name", () => {
+ const scatter = (field: string, ys: number[], axisValueFormatter?: never) =>
+ cartesian({
+ chartType: "scatter",
+ v3: true,
+ xData: ys.map((_, i) => i),
+ xField: "x",
+ yFields: [field],
+ yDataMap: { [field]: ys },
+ chartHeight: 240,
+ axisValueFormatter,
+ }) as unknown as {
+ grid: { left: unknown };
+ yAxis: {
+ nameGap: number;
+ nameTruncate?: { maxWidth: number };
+ };
+ };
+
+ test("the gap clears the widest tick label", () => {
+ const wide = scatter("churn", [10, 1234567]).yAxis.nameGap;
+ const narrow = scatter("churn", [1, 4]).yAxis.nameGap;
+ expect(wide).toBeGreaterThan(narrow);
+ expect(narrow).toBe(1 * 7 + 16);
+ });
+
+ test("a long name is truncated to 60% of the height", () => {
+ const axis = scatter("net_revenue_retention_pct", [1, 2]).yAxis;
+ expect(axis.nameTruncate?.maxWidth).toBe(144);
+ });
+
+ test("the left margin leaves room for the name", () => {
+ expect(scatter("churn", [1, 2]).grid.left).toBe(28);
+ });
+});
+
+describe("value label formatter", () => {
+ const label = (o: Option) =>
+ o.series[0].label as { formatter: (p: { value: unknown }) => string };
+
+ test("labels use valueLabelFormatter before the tick formatter", () => {
+ const option = cartesian({
+ showValues: true,
+ axisValueFormatter: (v) => "tick " + v,
+ valueLabelFormatter: (v) => "label " + v,
+ });
+ expect(label(option).formatter({ value: 5 })).toBe("label 5");
+ });
+
+ test("without one, labels fall back to the tick formatter", () => {
+ const option = cartesian({
+ showValues: true,
+ axisValueFormatter: (v) => "tick " + v,
+ });
+ expect(label(option).formatter({ value: 5 })).toBe("tick 5");
+ });
+});
+
+describe("stacked tooltip total", () => {
+ test("the total is free of float noise", () => {
+ const option = cartesian({
+ stacked: true,
+ yDataMap: { a: [0.1], b: [0.2] },
+ xData: ["A"],
+ yFields: ["a", "b"],
+ valueFormatter: (v) => v + "%",
+ });
+ const formatter = (
+ option.tooltip as {
+ formatter: (p: unknown) => string;
+ }
+ ).formatter;
+ const html = formatter([
+ { seriesIndex: 0, seriesName: "A", value: 0.1, axisValueLabel: "A" },
+ { seriesIndex: 1, seriesName: "B", value: 0.2, axisValueLabel: "A" },
+ { seriesIndex: 1, seriesName: "C", value: 1.1, axisValueLabel: "A" },
+ ]);
+ expect(html).toContain("Total: 1.4%");
+ expect(html).not.toContain("1.4000000000000001");
+ });
+});
+
+describe("bar rounding", () => {
+ type Item =
+ | number
+ | { value: number; itemStyle?: { borderRadius?: number[] } };
+ const radius = (s: Series, i: number) => {
+ const item = (s.data as Item[])[i];
+ return typeof item === "object" ? item.itemStyle?.borderRadius : undefined;
+ };
+ const seriesRadius = (s: Series) =>
+ (s.itemStyle as { borderRadius: number[] }).borderRadius;
+
+ test("a stack rounds only its outermost segment", () => {
+ const option = cartesian({
+ stacked: true,
+ yFields: ["a", "b", "c"],
+ yDataMap: { a: [10, 10], b: [20, 0], c: [30, 5] },
+ });
+ // Series radius is square; the top segment of each column is rounded.
+ expect(option.series.map(seriesRadius)).toEqual([
+ [0, 0, 0, 0],
+ [0, 0, 0, 0],
+ [0, 0, 0, 0],
+ ]);
+ expect(radius(option.series[2], 0)).toEqual([4, 4, 0, 0]);
+ expect(radius(option.series[1], 0)).toBeUndefined();
+ expect(radius(option.series[0], 0)).toBeUndefined();
+ });
+
+ test("a zero or missing top segment hands the radius to the one below", () => {
+ const option = cartesian({
+ stacked: true,
+ yFields: ["a", "b", "c"],
+ yDataMap: { a: [10], b: [20], c: [0] },
+ xData: ["A"],
+ });
+ expect(radius(option.series[1], 0)).toEqual([4, 4, 0, 0]);
+ expect(radius(option.series[2], 0)).toBeUndefined();
+ });
+
+ test("a negative bar is rounded at its far end", () => {
+ const option = cartesian({
+ yFields: ["a"],
+ yDataMap: { a: [40, -25, 15] },
+ });
+ expect(seriesRadius(option.series[0])).toEqual([4, 4, 0, 0]);
+ expect(radius(option.series[0], 1)).toEqual([0, 0, 4, 4]);
+ expect(radius(option.series[0], 0)).toBeUndefined();
+ });
+
+ test("a mixed-sign stack rounds the outer end on each side", () => {
+ const option = cartesian({
+ stacked: true,
+ yFields: ["a", "b", "c"],
+ xData: ["A"],
+ yDataMap: { a: [10], b: [-5], c: [-7] },
+ });
+ expect(radius(option.series[0], 0)).toEqual([4, 4, 0, 0]);
+ expect(radius(option.series[1], 0)).toBeUndefined();
+ expect(radius(option.series[2], 0)).toEqual([0, 0, 4, 4]);
+ });
+
+ test("horizontal bars round the right end, or the left for negatives", () => {
+ const option = buildHorizontalBarOption(
+ {
+ xData: ["A", "B"],
+ yDataMap: { a: [4, -4], b: [3, 2] },
+ yFields: ["a", "b"],
+ colors: ["#f00", "#0f0"],
+ showLegend: true,
+ },
+ true,
+ ) as unknown as { series: Series[] };
+ expect(radius(option.series[1], 0)).toEqual([0, 4, 4, 0]);
+ expect(radius(option.series[0], 1)).toEqual([4, 0, 0, 4]);
+ });
+
+ test("an unstacked positive bar keeps the series radius", () => {
+ const option = cartesian();
+ expect(seriesRadius(option.series[0])).toEqual([4, 4, 0, 0]);
+ expect(option.series[0].data).toEqual([1, 2, 3]);
+ });
+
+ test("a series radius from options removes the per-item radii", () => {
+ const built = cartesian({ yFields: ["a"], yDataMap: { a: [4, -4] } });
+ const merged = mergeChartOptions(
+ built,
+ {
+ series: [{ itemStyle: { borderRadius: 0 } }],
+ },
+ true,
+ ) as unknown as Option;
+ expect(radius(merged.series[0], 1)).toBeUndefined();
+ expect(seriesRadius(merged.series[0])).toBe(0 as unknown as number[]);
+ });
+});
+
+describe("options patches replace component lists", () => {
+ test("an empty series list removes every built series", () => {
+ const built = cartesian();
+ expect(built.series).toHaveLength(2);
+ const merged = mergeChartOptions(
+ built,
+ {
+ series: [],
+ },
+ true,
+ ) as unknown as Option;
+ expect(merged.series).toEqual([]);
+ });
+
+ test("a patch with fewer entries keeps the rest of the built list", () => {
+ const merged = mergeChartOptions(
+ cartesian(),
+ {
+ series: [{ name: "first" }],
+ },
+ true,
+ ) as unknown as Option;
+ expect(merged.series).toHaveLength(2);
+ expect(merged.series[0].name).toBe("first");
+ });
+});
+
+describe("bars clipped by the axis max", () => {
+ type Item =
+ | number
+ | { value: number; itemStyle?: { borderRadius?: number[] } };
+ const merged = (patch: Record) =>
+ mergeChartOptions(
+ cartesian({ yFields: ["a"], yDataMap: { a: [40, 64, 88] } }),
+ patch,
+ true,
+ ) as unknown as Option;
+ const radius = (o: Option, i: number) => {
+ const item = (o.series[0].data as Item[])[i];
+ return typeof item === "object" ? item.itemStyle?.borderRadius : undefined;
+ };
+
+ test("a bar past a fixed axis max gets a square end", () => {
+ const option = merged({ yAxis: { max: 60 } });
+ expect(radius(option, 0)).toBeUndefined();
+ expect(radius(option, 1)).toEqual([0, 0, 0, 0]);
+ expect(radius(option, 2)).toEqual([0, 0, 0, 0]);
+ });
+
+ test("without a fixed max every bar keeps its rounded end", () => {
+ const option = merged({});
+ expect(radius(option, 2)).toBeUndefined();
+ });
+
+ test("a stack segment that crosses the max is the square one", () => {
+ const built = cartesian({
+ stacked: true,
+ yFields: ["a", "b"],
+ xData: ["A"],
+ yDataMap: { a: [40], b: [40] },
+ });
+ const option = mergeChartOptions(
+ built,
+ {
+ yAxis: { max: 60 },
+ },
+ true,
+ ) as unknown as Option;
+ const top = (option.series[1].data as Item[])[0];
+ expect(typeof top === "object" && top.itemStyle?.borderRadius).toEqual([
+ 0, 0, 0, 0,
+ ]);
+ });
+
+ test("horizontal bars past the x axis max get a square end", () => {
+ const built = buildHorizontalBarOption(
+ {
+ xData: ["A"],
+ yDataMap: { a: [88] },
+ yFields: ["a"],
+ colors: ["#f00"],
+ showLegend: false,
+ },
+ false,
+ );
+ const option = mergeChartOptions(
+ built,
+ {
+ xAxis: { max: 60 },
+ },
+ true,
+ ) as unknown as Option;
+ const item = (option.series[0].data as Item[])[0];
+ expect(typeof item === "object" && item.itemStyle?.borderRadius).toEqual([
+ 0, 0, 0, 0,
+ ]);
+ });
+});
+
+describe("rotated label interval", () => {
+ test("every nth rotated label is drawn, n from the slot width", () => {
+ const many = Array.from({ length: 100 }, (_, i) => `Category ${i}`);
+ const option = cartesian({
+ xData: many,
+ yDataMap: { a: many.map((_, i) => i) },
+ yFields: ["a"],
+ chartWidth: 600,
+ }) as unknown as { xAxis: { axisLabel: { interval: number } } };
+ // slot 4.8 px: 18 / 4.8 -> every 4th label.
+ expect(option.xAxis.axisLabel.interval).toBe(3);
+ });
+});
+
+describe("ticks of a narrow horizontal axis", () => {
+ const split = (chartWidth: number) =>
+ (
+ buildHorizontalBarOption(
+ {
+ xData: ["A"],
+ yDataMap: { v: [9000000] },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ chartWidth,
+ valueFormatter: (v) => "$" + Number(v).toLocaleString("en-US"),
+ },
+ false,
+ ) as unknown as { xAxis: { splitNumber?: number } }
+ ).xAxis.splitNumber;
+
+ test("a narrow chart gets fewer ticks for full-number labels", () => {
+ expect(split(280)).toBe(2);
+ });
+
+ test("a wide chart keeps the default tick count", () => {
+ expect(split(900)).toBeUndefined();
+ });
+});
+
+describe("row label interval", () => {
+ const interval = (rows: number, chartHeight: number) => {
+ const xData = Array.from({ length: rows }, (_, i) => `Row ${i}`);
+ return (
+ buildHorizontalBarOption(
+ {
+ xData,
+ yDataMap: { v: xData.map((_, i) => i) },
+ yFields: ["v"],
+ colors: ["#f00"],
+ showLegend: false,
+ chartHeight,
+ },
+ false,
+ ) as unknown as { yAxis: { axisLabel: { interval?: number } } }
+ ).yAxis.axisLabel.interval;
+ };
+
+ test("30 rows in 360 px draw every other label", () => {
+ // (360 - 56) / 30 = 10 px a row; 16 / 10 -> every 2nd label.
+ expect(interval(30, 360)).toBe(1);
+ });
+
+ test("rows with room keep every label", () => {
+ expect(interval(6, 360)).toBeUndefined();
+ });
+});
diff --git a/packages/appkit-ui/src/react/charts/__tests__/chart-components.test.tsx b/packages/appkit-ui/src/react/charts/__tests__/chart-components.test.tsx
new file mode 100644
index 000000000..99d248e8d
--- /dev/null
+++ b/packages/appkit-ui/src/react/charts/__tests__/chart-components.test.tsx
@@ -0,0 +1,355 @@
+import { cleanup, render, waitFor } from "@testing-library/react";
+import { afterEach, beforeAll, describe, expect, test, vi } from "vitest";
+
+import { useAnalyticsQuery } from "../../hooks/use-analytics-query";
+import { AreaChart } from "../area";
+import { BarChart } from "../bar";
+import { LineChart } from "../line";
+import { RadarChart } from "../radar";
+import { chartOption, installEChartsEnv } from "./helpers/echarts-env";
+
+vi.mock("../../hooks/use-analytics-query", () => ({
+ useAnalyticsQuery: vi.fn(),
+}));
+
+beforeAll(installEChartsEnv);
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+const rows = [
+ { month: "Jan", revenue: 100 },
+ { month: "Feb", revenue: 120 },
+];
+
+describe("chart-specific props", () => {
+ test.each([
+ ["LineChart", LineChart],
+ ["AreaChart", AreaChart],
+ ] as const)("%s accepts symbolSize", async (_name, Chart) => {
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
+ const { container } = render(
+ ,
+ );
+ await waitFor(() => expect(chartOption(container)).toBeDefined());
+ const option = chartOption<{ series: { symbolSize: number }[] }>(container);
+ expect(option?.series[0].symbolSize).toBe(3);
+ expect(warn.mock.calls.some((c) => String(c[0]).includes("ignores"))).toBe(
+ false,
+ );
+ });
+
+ test.each([
+ ["LineChart", LineChart],
+ ["AreaChart", AreaChart],
+ ] as const)(
+ "%s preserves deprecated horizontal orientation",
+ async (_name, Chart) => {
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
+ const { container } = render(
+ ,
+ );
+ await waitFor(() => expect(chartOption(container)).toBeDefined());
+ const option = chartOption<{
+ series: { type: string }[];
+ xAxis: { type: string }[];
+ yAxis: { type: string }[];
+ }>(container);
+ expect(option?.series[0].type).toBe("bar");
+ expect(option?.xAxis[0].type).toBe("value");
+ expect(option?.yAxis[0].type).toBe("category");
+ expect(
+ warn.mock.calls.some((c) =>
+ String(c[0]).includes("ignores `orientation`"),
+ ),
+ ).toBe(false);
+ },
+ );
+
+ test("query chart forwards transformer to the data hook", async () => {
+ vi.mocked(useAnalyticsQuery).mockReturnValue({
+ data: rows,
+ loading: false,
+ error: null,
+ errorCode: null,
+ warehouseStatus: null,
+ });
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
+ const transformer = vi.fn((input: Record[]) =>
+ input.slice(1),
+ );
+ const { container } = render(
+ ,
+ );
+ await waitFor(() => expect(chartOption(container)).toBeDefined());
+ expect(transformer).toHaveBeenCalledWith(rows);
+ const option = chartOption<{ xAxis: { data: string[] }[] }>(container);
+ expect(option?.xAxis[0].data).toEqual(["Feb"]);
+ expect(
+ warn.mock.calls.some((c) =>
+ String(c[0]).includes("ignores `transformer`"),
+ ),
+ ).toBe(false);
+ });
+
+ test("line charts apply numeric sorting unless category type is explicit", async () => {
+ const data = [
+ { code: "10", value: 1 },
+ { code: "9", value: 2 },
+ { code: "02", value: 3 },
+ ];
+ const { container, rerender } = render(
+ ,
+ );
+ type Option = {
+ xAxis: { data: unknown[] }[];
+ series: { data: unknown[] }[];
+ };
+ await waitFor(() =>
+ expect(chartOption