Skip to content
Alea0.1

Data display

Table

Rows and columns with sorting, row selection, a sticky header, resizable columns and an empty state.

Ant Design: Table

import { Table, TableHeader, Column, TableBody, Row, Cell } from '@alea/ui';

Examples

Sorting and selection

Click a header to sort; the checkboxes select rows.

Plugin
Kind
Users
Status
Contrast CheckerAccessibility3,410Live
Palette GeneratorColor1,240Live
Type ScaleType860Live
Spec SheetHandoff120Beta
Icon AuditIcons95Beta

0 selected

Sticky header, compact, resizable

A fixed height scrolls the body; drag the column edges.

Token
Sample
--alea-bg
--alea-surface
--alea-surface-deep
--alea-surface-raised
--alea-border
--alea-border-strong
--alea-text
--alea-text-muted
--alea-text-faint
--alea-accent
--alea-accent-strong
--alea-focus

Empty

renderEmptyState for no rows.

File
Format

No exports yet

Export tokens from the Figma plugin and they show up here.

Props

Table props

Data in rows and columns: sorting, row selection, sticky header, resizing, keyboard grid navigation (Ant's Table).

PropTypeDefaultDescription
density"compact" | "comfortable"'comfortable'compact rows (40 px) or comfortable (52 px, default).
maxHeightstring | number-Max height of the scroll area, e.g. 400.
resizableboolean-Lets people drag column edges to resize.
stickyHeaderboolean-Header stays visible while the body scrolls (needs a height on the container).

Column props

A column header; allowsSorting shows the sort arrow and makes it pressable.

PropTypeDefaultDescription
align"center" | "start" | "end"'start'Right-aligns numbers.
childrenReactNode-The children of the component. A function may be provided to alter the children based on component state.

Row props

A row; with selection it starts with a checkbox.

PropTypeDefaultDescription
childrenReactNode-The elements that make up the table. Includes the TableHeader, TableBody, Columns, and Rows. (React Aria)
classNameClassNameOrFunction<TableRenderProps>-The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. (React Aria)
hrefstring-A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). (React Aria)
idKey-The unique id of the column. (React Aria)
isDisabledboolean-Whether the row is disabled. (React Aria)
onPress((e: PressEvent) => void)-Handler that is called when the press is released over the target. (React Aria)
styleStyleOrFunction<DisclosureGroupRenderProps>-The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. (React Aria)
targetHTMLAttributeAnchorTarget-The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). (React Aria)
textValuestring-A string representation of the column's contents, used for accessibility announcements. (React Aria)
valueobject-The object value that this row represents. When using dynamic collections, this is set automatically. (React Aria)

Cell props

PropTypeDefaultDescription
align"center" | "start" | "end"-Text alignment: start (default), center, or end for numbers.

Accessibility

  • A grid: arrow keys move between cells, sorting is announced with aria-sort.
  • Mark one column isRowHeader so rows have names.

Keyboard

KeyDoes
Arrow keysMove between cells
Enter (header)Sorts
SpaceSelects the row
⌘A / Ctrl+ASelects all

Do and don't

Do

  • Right-align numbers (align="end").
  • Use renderEmptyState.

Don't

  • Don't use a table for layout.
Tested with axe, keyboard and screen reader roles