twico-ui 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms.txt CHANGED
@@ -1249,106 +1249,6 @@ import { Badge } from "twico-ui";
1249
1249
  <Badge tone="info" size="lg">12 new</Badge>
1250
1250
  ```
1251
1251
 
1252
- #### Boxplot
1253
-
1254
- A dependency-free inline-SVG box-and-whisker chart that draws one box per category from a five-number summary (min, Q1, median, Q3, max) with whiskers and optional outlier points. Reach for it to compare the spread, skew, and outliers of distributions across groups where a bar or line chart would hide the shape of the data.
1255
-
1256
- `import { Boxplot } from "twico-ui"`
1257
-
1258
- Props:
1259
- - `data` — `BoxplotDatum[]` · **required** — The boxes to plot, one per category, each a five-number summary with an optional array of outlier values.
1260
- - `color` — `string` · default `"var(--color-primary)"` — Box fill and stroke accent, accepting any CSS color including a design token reference.
1261
- - `height` — `number` · default `300` — Pixel height of the chart; the width fills its container at 100%.
1262
- - `showGrid` — `boolean` · default `true` — Whether to draw horizontal grid lines at the value axis ticks behind the boxes.
1263
- - `showAxis` — `boolean` · default `true` — Whether to render the value axis and the category labels under each box.
1264
- - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter applied to values in the per-box tooltip and the hidden data table.
1265
- - `ariaLabel` — `string` · default `"box plot"` — Accessible name for the chart's role="img" SVG; per-box values are exposed via the hidden data table.
1266
- - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1267
- - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1268
-
1269
- ```jsx
1270
- import { Boxplot } from "twico-ui";
1271
-
1272
- <Boxplot
1273
- data={[
1274
- { label: "API", min: 12, q1: 24, median: 33, q3: 42, max: 58, outliers: [72] },
1275
- { label: "Web", min: 18, q1: 30, median: 41, q3: 52, max: 66 },
1276
- { label: "Cache", min: 8, q1: 20, median: 27, q3: 38, max: 49 },
1277
- ]}
1278
- valueFormat={(v) => `${v}ms`}
1279
- />
1280
- ```
1281
-
1282
- #### BubbleChart
1283
-
1284
- A dependency-free SVG bubble chart — a ScatterChart preset that sizes each dot by a third value (z) across two nice-scaled numeric axes. Reach for it when you need to show a third dimension (volume, revenue, weight) on top of an x/y relationship.
1285
-
1286
- `import { BubbleChart } from "twico-ui"`
1287
-
1288
- Props:
1289
- - `series` — `ScatterSeries[]` · **required** — The series to plot; each has an optional name/color and a list of { x, y, z?, label? } points.
1290
- - `bubble` — `boolean` · default `true` — Size the dots by their z value; on by default for BubbleChart, and also auto-enabled when any point has a numeric z.
1291
- - `maxBubble` — `number` · default `26` — Maximum bubble radius in pixels — the largest z value maps to this radius, with area scaling as radius ∝ √z.
1292
- - `dotRadius` — `number` · default `4.5` — Fixed dot radius in pixels used when bubble sizing is turned off.
1293
- - `height` — `number` · default `300` — Pixel height of the chart, which also sets the SVG aspect ratio so dots stay round.
1294
- - `xLabel` — `React.ReactNode` — Axis title drawn beneath the x axis.
1295
- - `yLabel` — `React.ReactNode` — Axis title drawn, rotated, beside the y axis.
1296
- - `showGrid` — `boolean` · default `true` — Whether to render the background grid lines behind the plotted points.
1297
- - `showLegend` — `boolean` · default `true when >1 series` — Whether to show the series legend; defaults on when there is more than one series.
1298
- - `xFormat` — `(value: number) => string` — Formatter for x values in tooltips and the hidden table; defaults to valueFormat.
1299
- - `yFormat` — `(value: number) => string` — Formatter for y values in tooltips and the hidden table; defaults to valueFormat.
1300
- - `valueFormat` — `(value: number) => string` — Fallback value formatter for x/y/z, using locale-grouped numbers by default.
1301
- - `ariaLabel` — `string` · default `"bubble chart"` — Accessible name for the chart's role="img" SVG; per-point values are exposed via the hidden data table instead.
1302
- - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1303
- - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1304
-
1305
- ```jsx
1306
- import { BubbleChart } from "twico-ui";
1307
-
1308
- <BubbleChart
1309
- series={[
1310
- { name: "Plans", points: [
1311
- { x: 12, y: 40, z: 800, label: "Starter" },
1312
- { x: 26, y: 65, z: 2400, label: "Team" },
1313
- { x: 48, y: 82, z: 5200, label: "Business" },
1314
- ] },
1315
- ]}
1316
- xLabel="Seats"
1317
- yLabel="Satisfaction"
1318
- />
1319
- ```
1320
-
1321
- #### Candlestick
1322
-
1323
- An OHLC candlestick chart that draws one candle per period — a high→low wick and an open→close body colored by direction — as dependency-free inline SVG. Reach for it to visualize price or range data over time; use Chart for bars, lines and areas.
1324
-
1325
- `import { Candlestick } from "twico-ui"`
1326
-
1327
- Props:
1328
- - `data` — `CandlestickDatum[]` · **required** — OHLC data points, one candle each ({ label, open, high, low, close }), given in chronological order.
1329
- - `upColor` — `string` · default `"var(--color-success)"` — Color for up candles where close is greater than or equal to open, accepting any CSS color.
1330
- - `downColor` — `string` · default `"var(--color-danger)"` — Color for down candles where close is less than open, accepting any CSS color.
1331
- - `height` — `number` · default `300` — Pixel height of the chart; the width always fills the container at 100 percent.
1332
- - `showGrid` — `boolean` · default `true` — Whether to draw the horizontal value grid lines behind the candles.
1333
- - `showAxis` — `boolean` · default `true` — Whether to render the value axis and the category (x) labels, which thin out automatically when dense.
1334
- - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formats values in the per-candle tooltip and the hidden data-table cells.
1335
- - `ariaLabel` — `string` · default `"candlestick chart"` — Accessible name for the chart's SVG role="img"; aria-label is also accepted as an alternative.
1336
- - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1337
- - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1338
-
1339
- ```jsx
1340
- import { Candlestick } from "twico-ui";
1341
-
1342
- <Candlestick
1343
- valueFormat={(v) => `$${v}`}
1344
- data={[
1345
- { label: "Mon", open: 132, high: 138, low: 130, close: 136 },
1346
- { label: "Tue", open: 136, high: 141, low: 134, close: 135 },
1347
- { label: "Wed", open: 135, high: 137, low: 128, close: 129 },
1348
- ]}
1349
- />
1350
- ```
1351
-
1352
1252
  #### Card
1353
1253
 
1354
1254
  Card is a surface container for grouping related content, with an optional header (title/subtitle), body, and footer. Use it to present grouped information such as stats, summaries, or actions, optionally making it interactive with a hover-lift effect.
@@ -1410,50 +1310,6 @@ import { Carousel } from "twico-ui";
1410
1310
  </Carousel>
1411
1311
  ```
1412
1312
 
1413
- #### Chart
1414
-
1415
- A lightweight, dependency-free SVG chart that renders bar or line graphs (single or multi-series) with grid, axes, animated entrance, tooltips, and an optional legend. Use it to visualize small datasets like daily metrics or trends without pulling in a charting library.
1416
-
1417
- `import { Chart } from "twico-ui"`
1418
-
1419
- Props:
1420
- - `type` — `"bar" | "line"` · default `"bar"` — Selects the rendering style, drawing the data as grouped bars or as connected lines for trends over time.
1421
- - `data` — `ChartDatum[]` · **required** — Supplies the array of data points, each carrying a label plus one numeric field for every named series.
1422
- - `series` — `string[]` · default `["value"]` — Names the numeric fields to plot, where multiple keys yield grouped bars or multiple lines per data point.
1423
- - `height` — `number` · default `220` — Sets the chart's pixel height, controlling its vertical footprint while it scales horizontally to its container.
1424
- - `showGrid` — `boolean` · default `true` — Draws horizontal grid lines behind the data, on by default, to make values easier to read against the scale.
1425
- - `showAxis` — `boolean` · default `true` — Renders axis tick marks and label text, enabled by default, so viewers can map plotted values to categories.
1426
- - `showLegend` — `boolean` · default `false` — Displays a legend keying each series to its color, off by default and most useful when plotting multiple series.
1427
- - `valueFormat` — `(value: number) => string` — Formats raw numeric values into display strings for tooltips, letting you add units, separators, or currency symbols.
1428
- - `colors` — `string[]` · default `built-in token palette` — Per-series colors (any CSS color), cycled when shorter than series.
1429
- - `showValues` — `boolean` · default `false` — Print each value as a small data label on the bars or points.
1430
- - `animate` — `boolean` · default `true` — Play the entrance animation (bars grow, lines draw); respects prefers-reduced-motion.
1431
- - `ariaLabel` — `string` — Accessible name for the chart's <svg role="img">; defaults to a description of the chart type.
1432
-
1433
- ```jsx
1434
- import { Chart } from "twico-ui";
1435
-
1436
- <Chart
1437
- type="bar"
1438
- data={[
1439
- { label: "Mon", value: 240 },
1440
- { label: "Tue", value: 310 },
1441
- { label: "Wed", value: 280 },
1442
- ]}
1443
- valueFormat={(v) => `$${v}`}
1444
- />
1445
-
1446
- <Chart
1447
- type="line"
1448
- series={["signups", "active"]}
1449
- showLegend
1450
- data={[
1451
- { label: "Jan", signups: 120, active: 80 },
1452
- { label: "Feb", signups: 180, active: 140 },
1453
- ]}
1454
- />
1455
- ```
1456
-
1457
1313
  #### Datatable
1458
1314
 
1459
1315
  Datatable is an advanced, MUI Data Grid-style data table with sortable, filterable, hideable, pinnable, reorderable, and resizable columns, plus a toolbar, density control, multi-format export, optional checkbox selection with batch actions, an actions column, pagination, and a skeleton loading state. Use it to display large tabular datasets that need interactive sorting, filtering, grouping, aggregation, or a server-side mode where only the current page is loaded.
@@ -1476,7 +1332,8 @@ Props:
1476
1332
  - `height` — `number` · default `440` — Sets the maximum scroll height of the grid body in pixels before rows scroll internally, defaulting to 440.
1477
1333
  - `serverMode` — `boolean` · default `false` — Switches to server-side data handling so sorting, filtering, and paging are delegated to your backend; off by default.
1478
1334
  - `rowCount` — `number` · default `-` — Tells the grid the total number of server-side rows so pagination can render correctly in serverMode.
1479
- - `onServerChange` — `(state)=>void` · default `-` — Fires with the current query state (sort, filter, page) in serverMode so you can fetch the matching rows.
1335
+ - `onServerChange` — `(state)=>void` · default `-` — Fires (debounced) with the serverMode query — sort, filters, page, quickFilter, and visibleColumns/hiddenColumns — so you fetch and project the data.
1336
+ - `onColumnVisibilityChange` — `(visible)=>void` · default `-` — Fires with the visible column fields whenever the built-in Columns menu shows or hides a column, so a server can project columns.
1480
1337
  - `showExport` — `boolean` · default `false` — Shows the toolbar Export button (CSV split button with a format menu); hidden by default — enable it to expose exporting.
1481
1338
  - `showDensity` — `boolean` · default `false` — Shows the toolbar density button that cycles compact/standard/comfortable; hidden by default (the density prop still sets the row height).
1482
1339
  - `showPivot` — `boolean` · default `false` — Shows the toolbar Pivot button; hidden by default, but appears automatically when a pivot model or pivotMode is provided.
@@ -1579,31 +1436,400 @@ export default function Example() {
1579
1436
  },
1580
1437
  ];
1581
1438
 
1582
- // Actions for the toolbar that replaces the header when one or more rows are ticked.
1583
- // (A built-in "Edit" button is added automatically because some columns are editable.)
1584
- const batchActions = [
1585
- { label: "Export", icon: <Download />, onClick: (keys, selected, clear) => clear() },
1586
- { label: "Email", icon: <Mail />, onClick: (keys, selected, clear) => { console.log(selected); clear(); } },
1587
- { label: "Delete", icon: <Trash />, danger: true, onClick: (keys, selected, clear) => { setRows((d) => d.filter((r) => !keys.includes(r.id))); clear(); } },
1588
- ];
1439
+ // Actions for the toolbar that replaces the header when one or more rows are ticked.
1440
+ // (A built-in "Edit" button is added automatically because some columns are editable.)
1441
+ const batchActions = [
1442
+ { label: "Export", icon: <Download />, onClick: (keys, selected, clear) => clear() },
1443
+ { label: "Email", icon: <Mail />, onClick: (keys, selected, clear) => { console.log(selected); clear(); } },
1444
+ { label: "Delete", icon: <Trash />, danger: true, onClick: (keys, selected, clear) => { setRows((d) => d.filter((r) => !keys.includes(r.id))); clear(); } },
1445
+ ];
1446
+
1447
+ return (
1448
+ <Datatable
1449
+ columns={columns}
1450
+ rows={rows}
1451
+ checkboxSelection
1452
+ rowNumbers
1453
+ batchActions={batchActions}
1454
+ onRowUpdate={(updated) => setRows((d) => d.map((r) => (r.id === updated.id ? updated : r)))}
1455
+ onBatchUpdate={(changed) => setRows((d) => d.map((r) => changed.find((c) => c.id === r.id) || r))}
1456
+ showAggregation
1457
+ showDensity
1458
+ showExport
1459
+ rowPinning
1460
+ pageSize={10}
1461
+ />
1462
+ );
1463
+ }
1464
+ ```
1465
+
1466
+ #### Kanban
1467
+
1468
+ Kanban is a drag-and-drop board that arranges cards into columns you can drag between. Use it for visualizing and reorganizing work items (tasks, tickets, stages) by status, either controlled via cards + onCardMove or uncontrolled.
1469
+
1470
+ `import { Kanban } from "twico-ui"`
1471
+
1472
+ Props:
1473
+ - `columns` — `KanbanColumn[] ({ id: string; title: React.ReactNode; color?: string })` · **required** — Defines the board columns, each with an id matching cards' column field, a title, and an optional heading dot color.
1474
+ - `cards` — `KanbanCard[] ({ id; column; title?; description?; tags?; footer?; ... })` · **required** — Supplies the cards to render, each assigned to a column via its column field and carrying title, description, and tags.
1475
+ - `onCardMove` — `(cardId: string, toColumn: string, nextCards: KanbanCard[]) => void` — Fires when a card is dropped into a different column, passing the card id, target column, and updated card list.
1476
+ - `renderCard` — `(card: KanbanCard) => React.ReactNode` — Overrides the default card contents with a custom renderer, falling back to title, description, tags, and footer.
1477
+ - `defaultCards` — `KanbanCard[]` · default `[]` — Initial cards when uncontrolled (the board applies moves internally).
1478
+
1479
+ ```jsx
1480
+ import { Kanban } from "twico-ui";
1481
+
1482
+ <Kanban
1483
+ columns={[
1484
+ { id: "todo", title: "To do", color: "var(--slate-400)" },
1485
+ { id: "doing", title: "In progress", color: "var(--amber-500)" },
1486
+ { id: "done", title: "Done", color: "var(--emerald-500)" },
1487
+ ]}
1488
+ cards={[
1489
+ { id: "1", column: "todo", title: "Design tokens", tags: ["Design"] },
1490
+ { id: "2", column: "doing", title: "Datatable filters" },
1491
+ { id: "3", column: "done", title: "Ship release" },
1492
+ ]}
1493
+ onCardMove={(id, to) => {}}
1494
+ />
1495
+ ```
1496
+
1497
+ #### List
1498
+
1499
+ List renders a vertical stack of rows with optional leading/trailing slots, a title, and a description. Use it for compact data displays like people, files, or settings, where rows can be static, links, or buttons.
1500
+
1501
+ `import { List } from "twico-ui"`
1502
+
1503
+ Props:
1504
+ - `items` — `ListItemData[]` · **required** — Provides the rows to render, each with a title plus optional description, leading, trailing, onClick, href, and active fields.
1505
+ - `plain` — `boolean` · default `false` — Drops the card chrome to render borderless, transparent rows when set to true; defaults to false for the boxed style.
1506
+ - `emptyMessage` — `React.ReactNode` · default `"Nothing here yet"` — Shown as a centered zero-state row when items is empty, so an empty list reads as intentional rather than broken.
1507
+
1508
+ ```jsx
1509
+ import { List } from "twico-ui";
1510
+
1511
+ <List
1512
+ items={[
1513
+ { title: "Ada Park", description: "ada@twico.dev", trailing: "Active", onClick: () => {} },
1514
+ { title: "report.pdf", description: "2.4 MB", trailing: "Today" },
1515
+ ]}
1516
+ />
1517
+ ```
1518
+
1519
+ #### Pagination
1520
+
1521
+ Pagination renders page navigation with prev/next buttons and smart ellipsis truncation, keeping boundary and sibling pages visible. Use it to let users move through paged data (tables, lists, search results), optionally with a "Go to" page jumper.
1522
+
1523
+ `import { Pagination } from "twico-ui"`
1524
+
1525
+ Props:
1526
+ - `page` — `number` · default `1` — The currently active 1-based page number, used to highlight the active button and compute which pages to show.
1527
+ - `total` — `number` · **required** — Total number of pages available, determining the range of page buttons and when ellipsis truncation appears.
1528
+ - `onChange` — `(page: number) => void` — Fires with the destination page number whenever the user clicks a page, prev, next, or jumper control.
1529
+ - `siblings` — `number` · default `1` — Number of adjacent page buttons rendered on each side of the current page before ellipsis truncation kicks in.
1530
+ - `boundaries` — `number` · default `1` — Number of page buttons always kept visible at each end so the first and last pages stay reachable.
1531
+ - `size` — `"sm" | "md"` · default `"md"` — Sets the control density, sm or md, scaling button height and spacing to match the surrounding layout.
1532
+ - `showJumper` — `boolean` · default `false` — Adds a "Go to" number input so users can jump directly to a specific page instead of clicking through.
1533
+ - `jumperLabel` — `React.ReactNode` · default `"Go to"` — Text or node rendered before the jumper input, defaulting to "Go to", to clarify what the field does.
1534
+ - `getPageLabel` — `(page: number) => string` · default `(n) => `Page ${n}`` — Accessible label for each numbered page button, so screen readers announce "Page 3" rather than a bare number; override for i18n.
1535
+ - `defaultPage` — `number` · default `1` — Initial 1-based page when uncontrolled (no `page` prop).
1536
+ - `showPageJumper` — `boolean` · default `false` — Show a "Go to" page input for jumping directly to a page; preferred alias for showJumper.
1537
+
1538
+ ```jsx
1539
+ import { Pagination } from "twico-ui";
1540
+
1541
+ const [page, setPage] = useState(1);
1542
+
1543
+ <Pagination
1544
+ page={page}
1545
+ total={12}
1546
+ onChange={setPage}
1547
+ showJumper
1548
+ />
1549
+ ```
1550
+
1551
+ #### Stat
1552
+
1553
+ Stat is a KPI / metric card that displays a label, a large value, and optional icon, trend delta, and help text. Use it on dashboards or summary panels to surface a single key metric with its trend direction.
1554
+
1555
+ `import { Stat } from "twico-ui"`
1556
+
1557
+ Props:
1558
+ - `label` — `React.ReactNode` · **required** — Renders the metric's caption shown above the value, naming what the number represents such as "Revenue".
1559
+ - `value` — `React.ReactNode` · **required** — Renders the large primary metric value that anchors the card, like a count, currency amount, or percentage.
1560
+ - `icon` — `React.ReactNode` — Renders an optional icon in a tinted tile at the top-right corner to visually reinforce the metric's meaning.
1561
+ - `delta` — `React.ReactNode` — Shows the trend change beside the value, such as "+12.5%" or "-3%", to convey movement over a period.
1562
+ - `deltaDirection` — `"up" | "down" | "flat"` — Forces the delta's direction and color (up, down, or flat); otherwise it is inferred from a leading minus sign.
1563
+ - `helpText` — `React.ReactNode` — Renders muted context after the delta, such as "vs last month", to clarify the comparison period.
1564
+ - `plain` — `boolean` · default `false` — Strips the card chrome (border, background, and padding) so the stat blends into an existing surface.
1565
+
1566
+ ```jsx
1567
+ import { Stat } from "twico-ui";
1568
+
1569
+ <Stat
1570
+ label="Revenue"
1571
+ value="$48,200"
1572
+ delta="+12.5%"
1573
+ helpText="vs last month"
1574
+ />
1575
+ <Stat
1576
+ label="Churn"
1577
+ value="2.1%"
1578
+ delta="-0.4%"
1579
+ deltaDirection="up"
1580
+ helpText="improved"
1581
+ />
1582
+ ```
1583
+
1584
+ #### Table
1585
+
1586
+ A data table with a styled header, hover and zebra-striped rows, client-side click-to-sort headers, custom cell renderers, and selected-row highlighting. Use it to display structured rows of data when you need lightweight sorting and per-column rendering or alignment.
1587
+
1588
+ `import { Table } from "twico-ui"`
1589
+
1590
+ Props:
1591
+ - `columns` — `TableColumn<T>[]` · **required** — Defines each column with key, header, optional align, width, sortable flag, and a custom render function for cell content.
1592
+ - `hover` — `boolean` · default `true` — Highlights the row under the cursor on mouse-over, on by default to aid scanning and pointing at dense rows.
1593
+ - `striped` — `boolean` · default `false` — Applies zebra striping to alternating rows when enabled, improving readability across wide tables of similar-looking data.
1594
+ - `size` — `"sm" | "md"` · default `"md"` — Controls cell padding density, choosing sm for compact rows or md for the default roomier spacing.
1595
+ - `sortable` — `boolean` · default `false` — Enables client-side click-to-sort headers when true, letting users reorder rows by any column marked sortable.
1596
+ - `rowKey` — `(row: T, index: number) => string | number` — Returns a stable unique key for each row from its data and index, defaulting to the row index.
1597
+ - `selectedKeys` — `Array<string | number>` — Lists the keys of rows to render with selected-row highlighting, useful for marking chosen or active records.
1598
+ - `sort` — `TableSort | null` — Controlled sort state — pair with onSortChange (null = unsorted).
1599
+ - `defaultSort` — `TableSort` · default `{ key: null, dir: "asc" }` — Initial sort when uncontrolled.
1600
+ - `onSortChange` — `(sort: TableSort) => void` — Fired when a sortable header is clicked with the next sort state.
1601
+ - `stickyHeader` — `boolean` · default `false` — Pin the header to the top while the body scrolls (use with maxHeight or an enclosing scroll container).
1602
+ - `maxHeight` — `number | string` — Cap the table height and give it its own vertical scroll area (CSS length or number of px); enables stickyHeader to shine.
1603
+ - `loading` — `boolean` · default `false` — Renders shimmering skeleton rows instead of data and sets aria-busy, avoiding a flash-of-empty during fetches.
1604
+ - `loadingRows` — `number` · default `8` — Number of skeleton rows to show while loading is true.
1605
+ - `emptyMessage` — `React.ReactNode` · default `"No data"` — Rendered as a single full-width row when rows is empty instead of a bare header over a blank body.
1606
+ - `ariaLabel` — `string` — Accessible name applied to the <table> itself (not the wrapper div); a raw aria-label prop takes precedence over it.
1607
+ - `caption` — `React.ReactNode` — Renders a visually-hidden <caption> naming the table for assistive technology.
1608
+ - `rows` — `T[]` — Row objects.
1609
+ - `field (column)` — `string` — Alias for key (Datatable vocabulary); key wins when both are set.
1610
+ - `headerName (column)` — `React.ReactNode` — Alias for header (Datatable vocabulary); header wins when both are set.
1611
+ - `renderCell (column)` — `(value: any, row: T, index: number) => React.ReactNode` — Alias for render (Datatable vocabulary); render wins when both are set.
1612
+
1613
+ ```jsx
1614
+ import { Table } from "twico-ui";
1615
+
1616
+ const users = [
1617
+ { id: 1, name: "Ava Stone", role: "Admin", status: "Active", mrr: 480 },
1618
+ { id: 2, name: "Liam Reed", role: "Editor", status: "Invited", mrr: 120 },
1619
+ { id: 3, name: "Noah Park", role: "Viewer", status: "Active", mrr: 60 },
1620
+ ];
1621
+
1622
+ <Table
1623
+ sortable
1624
+ striped
1625
+ rowKey={(r) => r.id}
1626
+ columns={[
1627
+ { field: "name", headerName: "Name" },
1628
+ { field: "role", headerName: "Role" },
1629
+ { field: "status", headerName: "Status" },
1630
+ { field: "mrr", headerName: "MRR", align: "right" },
1631
+ ]}
1632
+ rows={users}
1633
+ />
1634
+ ```
1635
+
1636
+ #### Tag
1637
+
1638
+ Tag is a removable chip for displaying filters, selected items, or keywords. Use it when you need compact, dismissible labels with an optional leading icon and an optional remove (×) button.
1639
+
1640
+ `import { Tag } from "twico-ui"`
1641
+
1642
+ Props:
1643
+ - `onRemove` — `(e: React.MouseEvent<HTMLButtonElement>) => void` — Renders the remove (×) button and handles its click, letting users dismiss the tag as a filter or selection.
1644
+ - `variant` — `"soft" | "solid" | "outline"` · default `"soft"` — Chooses the fill style between soft, solid, and outline to control how prominently the tag reads.
1645
+ - `tone` — `"neutral" | "primary" | "success" | "warning" | "danger" | "info"` · default `"neutral"` — Sets the semantic color from six options like success or danger; defaults to neutral (the classic chip).
1646
+ - `leftIcon` — `React.ReactNode` — Renders an optional leading icon before the label, useful for signaling the tag's category or status.
1647
+ - `children` — `React.ReactNode` — Provides the tag's label content, typically the filter name, selected item, or keyword being displayed.
1648
+
1649
+ ```jsx
1650
+ import { Tag } from "twico-ui";
1651
+
1652
+ <Tag onRemove={() => {}}>React</Tag>
1653
+ <Tag leftIcon={<span>#</span>}>design-system</Tag>
1654
+ <Tag>read-only</Tag>
1655
+ ```
1656
+
1657
+ #### Timeline
1658
+
1659
+ Timeline renders a vertical list of events as node dots connected by a rail, each showing a title, optional timestamp, and description. Use it for activity feeds, order tracking, or history views.
1660
+
1661
+ `import { Timeline } from "twico-ui"`
1662
+
1663
+ Props:
1664
+ - `items` — `TimelineItem[] — { title, time?, description?, icon?, tone? }` · **required** — Array of events to render as connected node dots, each with a title, optional time, description, icon, and primary/success/warning/danger tone.
1665
+ - `className` — `string` · default `""` — Extra CSS class appended to the root <ul> so you can layer custom spacing or styling onto the timeline.
1666
+ - `tone (TimelineItem)` — `"primary" | "info" | "success" | "warning" | "danger"` — Added `info` value to the per-item node tone union; maps the dot to var(--color-info) with var(--color-info-fg) icon color.
1667
+
1668
+ ```jsx
1669
+ import { Timeline } from "twico-ui";
1670
+
1671
+ <Timeline
1672
+ items={[
1673
+ { title: "Order placed", time: "9:41 AM", description: "We received your order.", tone: "primary" },
1674
+ { title: "Shipped", time: "2:10 PM", description: "Left the warehouse.", tone: "success" },
1675
+ { title: "Out for delivery", time: "Tomorrow" },
1676
+ ]}
1677
+ />
1678
+ ```
1679
+
1680
+ ### Charts
1681
+
1682
+ #### Boxplot
1683
+
1684
+ A dependency-free inline-SVG box-and-whisker chart that draws one box per category from a five-number summary (min, Q1, median, Q3, max) with whiskers and optional outlier points. Reach for it to compare the spread, skew, and outliers of distributions across groups where a bar or line chart would hide the shape of the data.
1685
+
1686
+ `import { Boxplot } from "twico-ui"`
1687
+
1688
+ Props:
1689
+ - `data` — `BoxplotDatum[]` · **required** — The boxes to plot, one per category, each a five-number summary with an optional array of outlier values.
1690
+ - `color` — `string` · default `"var(--color-primary)"` — Box fill and stroke accent, accepting any CSS color including a design token reference.
1691
+ - `height` — `number` · default `300` — Pixel height of the chart; the width fills its container at 100%.
1692
+ - `showGrid` — `boolean` · default `true` — Whether to draw horizontal grid lines at the value axis ticks behind the boxes.
1693
+ - `showAxis` — `boolean` · default `true` — Whether to render the value axis and the category labels under each box.
1694
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter applied to values in the per-box tooltip and the hidden data table.
1695
+ - `ariaLabel` — `string` · default `"box plot"` — Accessible name for the chart's role="img" SVG; per-box values are exposed via the hidden data table.
1696
+ - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1697
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1698
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1699
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
1700
+
1701
+ ```jsx
1702
+ import { Boxplot } from "twico-ui";
1703
+
1704
+ <Boxplot
1705
+ data={[
1706
+ { label: "API", min: 12, q1: 24, median: 33, q3: 42, max: 58, outliers: [72] },
1707
+ { label: "Web", min: 18, q1: 30, median: 41, q3: 52, max: 66 },
1708
+ { label: "Cache", min: 8, q1: 20, median: 27, q3: 38, max: 49 },
1709
+ ]}
1710
+ valueFormat={(v) => `${v}ms`}
1711
+ />
1712
+ ```
1713
+
1714
+ #### BubbleChart
1715
+
1716
+ A dependency-free SVG bubble chart — a ScatterChart preset that sizes each dot by a third value (z) across two nice-scaled numeric axes. Reach for it when you need to show a third dimension (volume, revenue, weight) on top of an x/y relationship.
1717
+
1718
+ `import { BubbleChart } from "twico-ui"`
1719
+
1720
+ Props:
1721
+ - `series` — `ScatterSeries[]` · **required** — The series to plot; each has an optional name/color and a list of { x, y, z?, label? } points.
1722
+ - `bubble` — `boolean` · default `true` — Size the dots by their z value; on by default for BubbleChart, and also auto-enabled when any point has a numeric z.
1723
+ - `maxBubble` — `number` · default `26` — Maximum bubble radius in pixels — the largest z value maps to this radius, with area scaling as radius ∝ √z.
1724
+ - `dotRadius` — `number` · default `4.5` — Fixed dot radius in pixels used when bubble sizing is turned off.
1725
+ - `height` — `number` · default `300` — Pixel height of the chart, which also sets the SVG aspect ratio so dots stay round.
1726
+ - `xLabel` — `React.ReactNode` — Axis title drawn beneath the x axis.
1727
+ - `yLabel` — `React.ReactNode` — Axis title drawn, rotated, beside the y axis.
1728
+ - `showGrid` — `boolean` · default `true` — Whether to render the background grid lines behind the plotted points.
1729
+ - `showLegend` — `boolean` · default `true when >1 series` — Whether to show the series legend; defaults on when there is more than one series.
1730
+ - `xFormat` — `(value: number) => string` — Formatter for x values in tooltips and the hidden table; defaults to valueFormat.
1731
+ - `yFormat` — `(value: number) => string` — Formatter for y values in tooltips and the hidden table; defaults to valueFormat.
1732
+ - `valueFormat` — `(value: number) => string` — Fallback value formatter for x/y/z, using locale-grouped numbers by default.
1733
+ - `ariaLabel` — `string` · default `"bubble chart"` — Accessible name for the chart's role="img" SVG; per-point values are exposed via the hidden data table instead.
1734
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1735
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1736
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1737
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
1738
+
1739
+ ```jsx
1740
+ import { BubbleChart } from "twico-ui";
1741
+
1742
+ <BubbleChart
1743
+ series={[
1744
+ { name: "Plans", points: [
1745
+ { x: 12, y: 40, z: 800, label: "Starter" },
1746
+ { x: 26, y: 65, z: 2400, label: "Team" },
1747
+ { x: 48, y: 82, z: 5200, label: "Business" },
1748
+ ] },
1749
+ ]}
1750
+ xLabel="Seats"
1751
+ yLabel="Satisfaction"
1752
+ />
1753
+ ```
1754
+
1755
+ #### Candlestick
1756
+
1757
+ An OHLC candlestick chart that draws one candle per period — a high→low wick and an open→close body colored by direction — as dependency-free inline SVG. Reach for it to visualize price or range data over time; use Chart for bars, lines and areas.
1758
+
1759
+ `import { Candlestick } from "twico-ui"`
1760
+
1761
+ Props:
1762
+ - `data` — `CandlestickDatum[]` · **required** — OHLC data points, one candle each ({ label, open, high, low, close }), given in chronological order.
1763
+ - `upColor` — `string` · default `"var(--color-success)"` — Color for up candles where close is greater than or equal to open, accepting any CSS color.
1764
+ - `downColor` — `string` · default `"var(--color-danger)"` — Color for down candles where close is less than open, accepting any CSS color.
1765
+ - `height` — `number` · default `300` — Pixel height of the chart; the width always fills the container at 100 percent.
1766
+ - `showGrid` — `boolean` · default `true` — Whether to draw the horizontal value grid lines behind the candles.
1767
+ - `showAxis` — `boolean` · default `true` — Whether to render the value axis and the category (x) labels, which thin out automatically when dense.
1768
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formats values in the per-candle tooltip and the hidden data-table cells.
1769
+ - `ariaLabel` — `string` · default `"candlestick chart"` — Accessible name for the chart's SVG role="img"; aria-label is also accepted as an alternative.
1770
+ - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1771
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1772
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1773
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
1774
+
1775
+ ```jsx
1776
+ import { Candlestick } from "twico-ui";
1777
+
1778
+ <Candlestick
1779
+ valueFormat={(v) => `$${v}`}
1780
+ data={[
1781
+ { label: "Mon", open: 132, high: 138, low: 130, close: 136 },
1782
+ { label: "Tue", open: 136, high: 141, low: 134, close: 135 },
1783
+ { label: "Wed", open: 135, high: 137, low: 128, close: 129 },
1784
+ ]}
1785
+ />
1786
+ ```
1787
+
1788
+ #### Chart
1789
+
1790
+ A lightweight, dependency-free SVG chart that renders bar or line graphs (single or multi-series) with grid, axes, animated entrance, tooltips, and an optional legend. Use it to visualize small datasets like daily metrics or trends without pulling in a charting library.
1791
+
1792
+ `import { Chart } from "twico-ui"`
1793
+
1794
+ Props:
1795
+ - `type` — `"bar" | "line"` · default `"bar"` — Selects the rendering style, drawing the data as grouped bars or as connected lines for trends over time.
1796
+ - `data` — `ChartDatum[]` · **required** — Supplies the array of data points, each carrying a label plus one numeric field for every named series.
1797
+ - `series` — `string[]` · default `["value"]` — Names the numeric fields to plot, where multiple keys yield grouped bars or multiple lines per data point.
1798
+ - `height` — `number` · default `220` — Sets the chart's pixel height, controlling its vertical footprint while it scales horizontally to its container.
1799
+ - `showGrid` — `boolean` · default `true` — Draws horizontal grid lines behind the data, on by default, to make values easier to read against the scale.
1800
+ - `showAxis` — `boolean` · default `true` — Renders axis tick marks and label text, enabled by default, so viewers can map plotted values to categories.
1801
+ - `showLegend` — `boolean` · default `false` — Displays a legend keying each series to its color, off by default and most useful when plotting multiple series.
1802
+ - `valueFormat` — `(value: number) => string` — Formats raw numeric values into display strings for tooltips, letting you add units, separators, or currency symbols.
1803
+ - `colors` — `string[]` · default `built-in token palette` — Per-series colors (any CSS color), cycled when shorter than series.
1804
+ - `showValues` — `boolean` · default `false` — Print each value as a small data label on the bars or points.
1805
+ - `animate` — `boolean` · default `true` — Play the entrance animation (bars grow, lines draw); respects prefers-reduced-motion.
1806
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1807
+ - `crosshair` — `boolean` · default `true` — Show a vertical crosshair guide line at the hovered category on line/area/vertical-bar charts.
1808
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
1809
+ - `ariaLabel` — `string` — Accessible name for the chart's <svg role="img">; defaults to a description of the chart type.
1810
+
1811
+ ```jsx
1812
+ import { Chart } from "twico-ui";
1813
+
1814
+ <Chart
1815
+ type="bar"
1816
+ data={[
1817
+ { label: "Mon", value: 240 },
1818
+ { label: "Tue", value: 310 },
1819
+ { label: "Wed", value: 280 },
1820
+ ]}
1821
+ valueFormat={(v) => `$${v}`}
1822
+ />
1589
1823
 
1590
- return (
1591
- <Datatable
1592
- columns={columns}
1593
- rows={rows}
1594
- checkboxSelection
1595
- rowNumbers
1596
- batchActions={batchActions}
1597
- onRowUpdate={(updated) => setRows((d) => d.map((r) => (r.id === updated.id ? updated : r)))}
1598
- onBatchUpdate={(changed) => setRows((d) => d.map((r) => changed.find((c) => c.id === r.id) || r))}
1599
- showAggregation
1600
- showDensity
1601
- showExport
1602
- rowPinning
1603
- pageSize={10}
1604
- />
1605
- );
1606
- }
1824
+ <Chart
1825
+ type="line"
1826
+ series={["signups", "active"]}
1827
+ showLegend
1828
+ data={[
1829
+ { label: "Jan", signups: 120, active: 80 },
1830
+ { label: "Feb", signups: 180, active: 140 },
1831
+ ]}
1832
+ />
1607
1833
  ```
1608
1834
 
1609
1835
  #### DonutChart
@@ -1627,6 +1853,7 @@ Props:
1627
1853
  - `ariaLabel` — `string` · default `"donut chart"` — Accessible name for the <svg role="img">; per-slice values live in the hidden data table, not this label.
1628
1854
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1629
1855
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1856
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1630
1857
 
1631
1858
  ```jsx
1632
1859
  import { DonutChart } from "twico-ui";
@@ -1662,6 +1889,7 @@ Props:
1662
1889
  - `ariaLabel` — `string` · default `"funnel chart"` — Accessible name for the chart's `<svg role="img">`; also accepts `aria-label`, with per-stage values in the hidden table.
1663
1890
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative (WCAG 1.1.1).
1664
1891
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1892
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1665
1893
 
1666
1894
  ```jsx
1667
1895
  import { FunnelChart } from "twico-ui";
@@ -1707,6 +1935,7 @@ Props:
1707
1935
  - `ariaLabel` — `string` — Accessible name for the SVG role="img"; defaults to a value summary and also accepts aria-label.
1708
1936
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative per WCAG 1.1.1.
1709
1937
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the gauge's accessible label.
1938
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1710
1939
 
1711
1940
  ```jsx
1712
1941
  import { Gauge } from "twico-ui";
@@ -1742,6 +1971,8 @@ Props:
1742
1971
  - `ariaLabel` — `string` · default `"heatmap"` — Accessible name for the chart's SVG role="img"; also accepts aria-label, with per-cell values exposed via the hidden table.
1743
1972
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative (WCAG 1.1.1).
1744
1973
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1974
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1975
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
1745
1976
 
1746
1977
  ```jsx
1747
1978
  import { Heatmap } from "twico-ui";
@@ -1758,91 +1989,6 @@ import { Heatmap } from "twico-ui";
1758
1989
  <Heatmap showValues colorScale="var(--emerald-500)" valueFormat={(v) => `${v}%`} data={cells} />
1759
1990
  ```
1760
1991
 
1761
- #### Kanban
1762
-
1763
- Kanban is a drag-and-drop board that arranges cards into columns you can drag between. Use it for visualizing and reorganizing work items (tasks, tickets, stages) by status, either controlled via cards + onCardMove or uncontrolled.
1764
-
1765
- `import { Kanban } from "twico-ui"`
1766
-
1767
- Props:
1768
- - `columns` — `KanbanColumn[] ({ id: string; title: React.ReactNode; color?: string })` · **required** — Defines the board columns, each with an id matching cards' column field, a title, and an optional heading dot color.
1769
- - `cards` — `KanbanCard[] ({ id; column; title?; description?; tags?; footer?; ... })` · **required** — Supplies the cards to render, each assigned to a column via its column field and carrying title, description, and tags.
1770
- - `onCardMove` — `(cardId: string, toColumn: string, nextCards: KanbanCard[]) => void` — Fires when a card is dropped into a different column, passing the card id, target column, and updated card list.
1771
- - `renderCard` — `(card: KanbanCard) => React.ReactNode` — Overrides the default card contents with a custom renderer, falling back to title, description, tags, and footer.
1772
- - `defaultCards` — `KanbanCard[]` · default `[]` — Initial cards when uncontrolled (the board applies moves internally).
1773
-
1774
- ```jsx
1775
- import { Kanban } from "twico-ui";
1776
-
1777
- <Kanban
1778
- columns={[
1779
- { id: "todo", title: "To do", color: "var(--slate-400)" },
1780
- { id: "doing", title: "In progress", color: "var(--amber-500)" },
1781
- { id: "done", title: "Done", color: "var(--emerald-500)" },
1782
- ]}
1783
- cards={[
1784
- { id: "1", column: "todo", title: "Design tokens", tags: ["Design"] },
1785
- { id: "2", column: "doing", title: "Datatable filters" },
1786
- { id: "3", column: "done", title: "Ship release" },
1787
- ]}
1788
- onCardMove={(id, to) => {}}
1789
- />
1790
- ```
1791
-
1792
- #### List
1793
-
1794
- List renders a vertical stack of rows with optional leading/trailing slots, a title, and a description. Use it for compact data displays like people, files, or settings, where rows can be static, links, or buttons.
1795
-
1796
- `import { List } from "twico-ui"`
1797
-
1798
- Props:
1799
- - `items` — `ListItemData[]` · **required** — Provides the rows to render, each with a title plus optional description, leading, trailing, onClick, href, and active fields.
1800
- - `plain` — `boolean` · default `false` — Drops the card chrome to render borderless, transparent rows when set to true; defaults to false for the boxed style.
1801
- - `emptyMessage` — `React.ReactNode` · default `"Nothing here yet"` — Shown as a centered zero-state row when items is empty, so an empty list reads as intentional rather than broken.
1802
-
1803
- ```jsx
1804
- import { List } from "twico-ui";
1805
-
1806
- <List
1807
- items={[
1808
- { title: "Ada Park", description: "ada@twico.dev", trailing: "Active", onClick: () => {} },
1809
- { title: "report.pdf", description: "2.4 MB", trailing: "Today" },
1810
- ]}
1811
- />
1812
- ```
1813
-
1814
- #### Pagination
1815
-
1816
- Pagination renders page navigation with prev/next buttons and smart ellipsis truncation, keeping boundary and sibling pages visible. Use it to let users move through paged data (tables, lists, search results), optionally with a "Go to" page jumper.
1817
-
1818
- `import { Pagination } from "twico-ui"`
1819
-
1820
- Props:
1821
- - `page` — `number` · default `1` — The currently active 1-based page number, used to highlight the active button and compute which pages to show.
1822
- - `total` — `number` · **required** — Total number of pages available, determining the range of page buttons and when ellipsis truncation appears.
1823
- - `onChange` — `(page: number) => void` — Fires with the destination page number whenever the user clicks a page, prev, next, or jumper control.
1824
- - `siblings` — `number` · default `1` — Number of adjacent page buttons rendered on each side of the current page before ellipsis truncation kicks in.
1825
- - `boundaries` — `number` · default `1` — Number of page buttons always kept visible at each end so the first and last pages stay reachable.
1826
- - `size` — `"sm" | "md"` · default `"md"` — Sets the control density, sm or md, scaling button height and spacing to match the surrounding layout.
1827
- - `showJumper` — `boolean` · default `false` — Adds a "Go to" number input so users can jump directly to a specific page instead of clicking through.
1828
- - `jumperLabel` — `React.ReactNode` · default `"Go to"` — Text or node rendered before the jumper input, defaulting to "Go to", to clarify what the field does.
1829
- - `getPageLabel` — `(page: number) => string` · default `(n) => `Page ${n}`` — Accessible label for each numbered page button, so screen readers announce "Page 3" rather than a bare number; override for i18n.
1830
- - `defaultPage` — `number` · default `1` — Initial 1-based page when uncontrolled (no `page` prop).
1831
- - `showPageJumper` — `boolean` · default `false` — Show a "Go to" page input for jumping directly to a page; preferred alias for showJumper.
1832
-
1833
- ```jsx
1834
- import { Pagination } from "twico-ui";
1835
-
1836
- const [page, setPage] = useState(1);
1837
-
1838
- <Pagination
1839
- page={page}
1840
- total={12}
1841
- onChange={setPage}
1842
- showJumper
1843
- />
1844
- ```
1845
-
1846
1992
  #### PieChart
1847
1993
 
1848
1994
  A dependency-free inline-SVG pie or donut chart that renders proportional slices of a whole from a single value series, with per-slice tooltips, an optional legend, percentage labels, and a donut center label. Reach for it to show part-to-whole composition; use Chart for bar/line/area trends.
@@ -1864,6 +2010,7 @@ Props:
1864
2010
  - `ariaLabel` — `string` · default `"pie chart" / "donut chart"` — Accessible name for the role="img" SVG; per-slice values live in the hidden data table, not this label.
1865
2011
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative for the chart (WCAG 1.1.1).
1866
2012
  - `caption` — `React.ReactNode` · default `chart's accessible label` — Caption for the hidden data table; defaults to the chart's accessible label.
2013
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1867
2014
 
1868
2015
  ```jsx
1869
2016
  import { PieChart } from "twico-ui";
@@ -1899,6 +2046,7 @@ Props:
1899
2046
  - `ariaLabel` — `string` · default `"polar area chart"` — Accessible name for the chart's SVG role="img"; aria-label is also accepted as an alternative.
1900
2047
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1901
2048
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
2049
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1902
2050
 
1903
2051
  ```jsx
1904
2052
  import { PolarAreaChart } from "twico-ui";
@@ -1939,6 +2087,7 @@ Props:
1939
2087
  - `ariaLabel` — `string` · default `"radar chart"` — Accessible name for the chart's role="img" SVG; also accepts the aria-label attribute.
1940
2088
  - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as a text alternative to the SVG for screen readers (WCAG 1.1.1).
1941
2089
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
2090
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
1942
2091
 
1943
2092
  ```jsx
1944
2093
  import { RadarChart } from "twico-ui";
@@ -1973,6 +2122,8 @@ Props:
1973
2122
  - `ariaLabel` — `string` · default `"range <type> chart"` — Accessible name for the chart's role="img" SVG; aria-label is also accepted as an alias.
1974
2123
  - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden min/max data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1975
2124
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
2125
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
2126
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
1976
2127
 
1977
2128
  ```jsx
1978
2129
  import { RangeChart } from "twico-ui";
@@ -2010,6 +2161,8 @@ Props:
2010
2161
  - `ariaLabel` — `string` · default `"scatter chart" / "bubble chart"` — Accessible name for the chart's role="img" SVG; also accepts aria-label. Per-point values live in the hidden table.
2011
2162
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
2012
2163
  - `caption` — `React.ReactNode` · default `chart's accessible label` — Caption for the hidden data table; defaults to the chart's accessible label.
2164
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
2165
+ - `zoomable` — `boolean` · default `false` — Enable drag-to-zoom plus shift-drag pan, mouse-wheel zoom, and a reset button over the chart.
2013
2166
 
2014
2167
  ```jsx
2015
2168
  import { ScatterChart } from "twico-ui";
@@ -2055,6 +2208,7 @@ Props:
2055
2208
  - `ariaLabel` — `string` — Accessible name for the `<svg role="img">`; defaults to a spoken summary of point count and first/last/min/max.
2056
2209
  - `tableFallback` — `boolean` · default `false` — Render a visually-hidden data table as a WCAG 1.1.1 text alternative; off by default since the aria-label usually suffices.
2057
2210
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the accessible label when not provided.
2211
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
2058
2212
 
2059
2213
  ```jsx
2060
2214
  import { Sparkline } from "twico-ui";
@@ -2064,135 +2218,6 @@ import { Sparkline } from "twico-ui";
2064
2218
  <Sparkline type="bar" height={28} data={[4, 6, 2, 8, 5, 7]} />
2065
2219
  ```
2066
2220
 
2067
- #### Stat
2068
-
2069
- Stat is a KPI / metric card that displays a label, a large value, and optional icon, trend delta, and help text. Use it on dashboards or summary panels to surface a single key metric with its trend direction.
2070
-
2071
- `import { Stat } from "twico-ui"`
2072
-
2073
- Props:
2074
- - `label` — `React.ReactNode` · **required** — Renders the metric's caption shown above the value, naming what the number represents such as "Revenue".
2075
- - `value` — `React.ReactNode` · **required** — Renders the large primary metric value that anchors the card, like a count, currency amount, or percentage.
2076
- - `icon` — `React.ReactNode` — Renders an optional icon in a tinted tile at the top-right corner to visually reinforce the metric's meaning.
2077
- - `delta` — `React.ReactNode` — Shows the trend change beside the value, such as "+12.5%" or "-3%", to convey movement over a period.
2078
- - `deltaDirection` — `"up" | "down" | "flat"` — Forces the delta's direction and color (up, down, or flat); otherwise it is inferred from a leading minus sign.
2079
- - `helpText` — `React.ReactNode` — Renders muted context after the delta, such as "vs last month", to clarify the comparison period.
2080
- - `plain` — `boolean` · default `false` — Strips the card chrome (border, background, and padding) so the stat blends into an existing surface.
2081
-
2082
- ```jsx
2083
- import { Stat } from "twico-ui";
2084
-
2085
- <Stat
2086
- label="Revenue"
2087
- value="$48,200"
2088
- delta="+12.5%"
2089
- helpText="vs last month"
2090
- />
2091
- <Stat
2092
- label="Churn"
2093
- value="2.1%"
2094
- delta="-0.4%"
2095
- deltaDirection="up"
2096
- helpText="improved"
2097
- />
2098
- ```
2099
-
2100
- #### Table
2101
-
2102
- A data table with a styled header, hover and zebra-striped rows, client-side click-to-sort headers, custom cell renderers, and selected-row highlighting. Use it to display structured rows of data when you need lightweight sorting and per-column rendering or alignment.
2103
-
2104
- `import { Table } from "twico-ui"`
2105
-
2106
- Props:
2107
- - `columns` — `TableColumn<T>[]` · **required** — Defines each column with key, header, optional align, width, sortable flag, and a custom render function for cell content.
2108
- - `hover` — `boolean` · default `true` — Highlights the row under the cursor on mouse-over, on by default to aid scanning and pointing at dense rows.
2109
- - `striped` — `boolean` · default `false` — Applies zebra striping to alternating rows when enabled, improving readability across wide tables of similar-looking data.
2110
- - `size` — `"sm" | "md"` · default `"md"` — Controls cell padding density, choosing sm for compact rows or md for the default roomier spacing.
2111
- - `sortable` — `boolean` · default `false` — Enables client-side click-to-sort headers when true, letting users reorder rows by any column marked sortable.
2112
- - `rowKey` — `(row: T, index: number) => string | number` — Returns a stable unique key for each row from its data and index, defaulting to the row index.
2113
- - `selectedKeys` — `Array<string | number>` — Lists the keys of rows to render with selected-row highlighting, useful for marking chosen or active records.
2114
- - `sort` — `TableSort | null` — Controlled sort state — pair with onSortChange (null = unsorted).
2115
- - `defaultSort` — `TableSort` · default `{ key: null, dir: "asc" }` — Initial sort when uncontrolled.
2116
- - `onSortChange` — `(sort: TableSort) => void` — Fired when a sortable header is clicked with the next sort state.
2117
- - `stickyHeader` — `boolean` · default `false` — Pin the header to the top while the body scrolls (use with maxHeight or an enclosing scroll container).
2118
- - `maxHeight` — `number | string` — Cap the table height and give it its own vertical scroll area (CSS length or number of px); enables stickyHeader to shine.
2119
- - `loading` — `boolean` · default `false` — Renders shimmering skeleton rows instead of data and sets aria-busy, avoiding a flash-of-empty during fetches.
2120
- - `loadingRows` — `number` · default `8` — Number of skeleton rows to show while loading is true.
2121
- - `emptyMessage` — `React.ReactNode` · default `"No data"` — Rendered as a single full-width row when rows is empty instead of a bare header over a blank body.
2122
- - `ariaLabel` — `string` — Accessible name applied to the <table> itself (not the wrapper div); a raw aria-label prop takes precedence over it.
2123
- - `caption` — `React.ReactNode` — Renders a visually-hidden <caption> naming the table for assistive technology.
2124
- - `rows` — `T[]` — Row objects.
2125
- - `field (column)` — `string` — Alias for key (Datatable vocabulary); key wins when both are set.
2126
- - `headerName (column)` — `React.ReactNode` — Alias for header (Datatable vocabulary); header wins when both are set.
2127
- - `renderCell (column)` — `(value: any, row: T, index: number) => React.ReactNode` — Alias for render (Datatable vocabulary); render wins when both are set.
2128
-
2129
- ```jsx
2130
- import { Table } from "twico-ui";
2131
-
2132
- const users = [
2133
- { id: 1, name: "Ava Stone", role: "Admin", status: "Active", mrr: 480 },
2134
- { id: 2, name: "Liam Reed", role: "Editor", status: "Invited", mrr: 120 },
2135
- { id: 3, name: "Noah Park", role: "Viewer", status: "Active", mrr: 60 },
2136
- ];
2137
-
2138
- <Table
2139
- sortable
2140
- striped
2141
- rowKey={(r) => r.id}
2142
- columns={[
2143
- { field: "name", headerName: "Name" },
2144
- { field: "role", headerName: "Role" },
2145
- { field: "status", headerName: "Status" },
2146
- { field: "mrr", headerName: "MRR", align: "right" },
2147
- ]}
2148
- rows={users}
2149
- />
2150
- ```
2151
-
2152
- #### Tag
2153
-
2154
- Tag is a removable chip for displaying filters, selected items, or keywords. Use it when you need compact, dismissible labels with an optional leading icon and an optional remove (×) button.
2155
-
2156
- `import { Tag } from "twico-ui"`
2157
-
2158
- Props:
2159
- - `onRemove` — `(e: React.MouseEvent<HTMLButtonElement>) => void` — Renders the remove (×) button and handles its click, letting users dismiss the tag as a filter or selection.
2160
- - `variant` — `"soft" | "solid" | "outline"` · default `"soft"` — Chooses the fill style between soft, solid, and outline to control how prominently the tag reads.
2161
- - `tone` — `"neutral" | "primary" | "success" | "warning" | "danger" | "info"` · default `"neutral"` — Sets the semantic color from six options like success or danger; defaults to neutral (the classic chip).
2162
- - `leftIcon` — `React.ReactNode` — Renders an optional leading icon before the label, useful for signaling the tag's category or status.
2163
- - `children` — `React.ReactNode` — Provides the tag's label content, typically the filter name, selected item, or keyword being displayed.
2164
-
2165
- ```jsx
2166
- import { Tag } from "twico-ui";
2167
-
2168
- <Tag onRemove={() => {}}>React</Tag>
2169
- <Tag leftIcon={<span>#</span>}>design-system</Tag>
2170
- <Tag>read-only</Tag>
2171
- ```
2172
-
2173
- #### Timeline
2174
-
2175
- Timeline renders a vertical list of events as node dots connected by a rail, each showing a title, optional timestamp, and description. Use it for activity feeds, order tracking, or history views.
2176
-
2177
- `import { Timeline } from "twico-ui"`
2178
-
2179
- Props:
2180
- - `items` — `TimelineItem[] — { title, time?, description?, icon?, tone? }` · **required** — Array of events to render as connected node dots, each with a title, optional time, description, icon, and primary/success/warning/danger tone.
2181
- - `className` — `string` · default `""` — Extra CSS class appended to the root <ul> so you can layer custom spacing or styling onto the timeline.
2182
- - `tone (TimelineItem)` — `"primary" | "info" | "success" | "warning" | "danger"` — Added `info` value to the per-item node tone union; maps the dot to var(--color-info) with var(--color-info-fg) icon color.
2183
-
2184
- ```jsx
2185
- import { Timeline } from "twico-ui";
2186
-
2187
- <Timeline
2188
- items={[
2189
- { title: "Order placed", time: "9:41 AM", description: "We received your order.", tone: "primary" },
2190
- { title: "Shipped", time: "2:10 PM", description: "Left the warehouse.", tone: "success" },
2191
- { title: "Out for delivery", time: "Tomorrow" },
2192
- ]}
2193
- />
2194
- ```
2195
-
2196
2221
  #### Treemap
2197
2222
 
2198
2223
  A dependency-free SVG treemap that partitions a rectangle into tiles sized in proportion to a flat list of values, using a squarified layout that keeps tile aspect ratios near 1:1. Reach for it to show the relative weight of parts within a whole — spend by category, storage by bucket — where a pie would crowd or a bar chart would lose the sense of area.
@@ -2209,6 +2234,7 @@ Props:
2209
2234
  - `ariaLabel` — `string` · default `"treemap"` — Accessible name for the chart's role="img" SVG; also accepts aria-label, with values exposed via the data table.
2210
2235
  - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table of value and share as an accessible text alternative (WCAG 1.1.1).
2211
2236
  - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
2237
+ - `onDataClick` — `(payload) => void` — Fires with the clicked item's data + metadata; the clicked mark also toggles a persistent selected outline.
2212
2238
 
2213
2239
  ```jsx
2214
2240
  import { Treemap } from "twico-ui";