import { MessageTable } from "@elabs-ai/components-ai";npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-aiPaste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.
Add the brand-ui MessageTable component (from @elabs-ai/components-ai) to this project. 1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`. 2. Look MessageTable up before writing code: `npx -y @elabs-ai/components-cli docs MessageTable` prints its real props, variants, what it pairs with and what to avoid. 3. If @elabs-ai/components-ai is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`. 4. Use it here: [the screen or file, and what it should show] 5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop. 6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.
Avoid
- Reaching for the DataTable instead — that is app chrome; this is message content, deliberately lighter.
- Throwing on a malformed spec — it falls back (MessageTableFallback), renders an em-dash for a missing cell, and drops half-arrived rows.
- Start-aligning numeric columns — numerics are end-aligned with tabular-nums so they compare down the column.
Works with
Examples
Sortable
Sortable — click a header to sort; numeric columns sort numerically.
Controlled Sort
Controlled sort — the parent owns the sort state.
Truncated
Truncated — `maxRows` caps the display and shows a "Showing N of M" notice.
Streaming Rows
Streaming / partial — columns known, rows still arriving → skeleton rows.
Partial Rows
Missing cells render an em-dash — a half-arrived row never crashes.
Empty
Empty (not streaming) — a real empty state row, never broken UI.
Fallback
Fallback — a non-object spec renders a typed fallback (no throw).
Custom Cell
Per-cell override — compose custom cell content (like ChangeReview.renderHunk).
Dark Theme
Dark theme — verifies token-driven surfaces + dividers in dark.
Focus Indicator
Focus indicator on sortable column headers (#313): Tab to a sort header and assert the compound indicator's OUTLINE layer (`outlineStyle: "solid"`, `--ring-contour`) that `focus-ring` adds. `boxShadow !== "none"` alone also passes on the legacy `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1` pattern (Tailwind's `ring-2` still paints a box-shadow), so it does not lock the fix.
API
MessageTable
| Prop | Type | Description |
|---|---|---|
specrequired | TableSpec | unknown | The serializable table specification produced by an LLM tool-call. |
sortable | boolean | Enable click-to-sort column headers. @default false |
sort | TableSort | null | Controlled sort. When provided, `onSortChange` is the only way to update it. |
defaultSort | TableSort | null | Uncontrolled initial sort. |
onSortChange | (sort: TableSort | null) => void | Called with the next sort (or `null`) when a header is clicked. |
maxRows | number | Cap the number of rendered rows; shows a "Showing N of M rows" notice. |
renderCell | RenderCell | Per-cell render override for custom composition. |
isStreaming | boolean | The spec is still streaming (columns-but-no-rows shows skeleton rows). |
streaming | boolean | @deprecated Use `isStreaming`. |
MessageTableFallback
| Prop | Type | Description |
|---|---|---|
message | string | Short human reason the table could not render. |