AnyLumino
API referenceastryxdata

Table

Render a data-driven Astryx table for notebook use.

Astryx Props

JSON-safe Table props forwarded to Astryx.

Supported Astryx props include:

  • data (T[]): Array of data items to render as rows. T must extend Record<string, unknown> (use 'interface MyRow extends Record<string, unknown>' for custom types).
  • columns (TableColumn<T>[]): Column definitions: each column has {key, header, width?, align?, renderCell?}. The 'header' field sets the column heading text. If omitted, columns are auto-generated from data object keys.
  • idKey ((keyof T & string) or ((item: T) => string or number)): Row key for React reconciliation. Pass a property name string or a function. Falls back to row index if omitted.
  • density ('compact' or 'balanced' or 'spacious'): Row density controlling cell padding and font size.
  • dividers ('rows' or 'columns' or 'grid' or 'none'): Divider style rendered between cells.
  • isStriped (boolean): Applies a background wash to even-numbered rows.
  • hasHover (boolean): Applies a hover highlight background to rows on pointer devices.
  • verticalAlign ('middle' or 'top' or 'bottom'): Vertical alignment for body row cells. Controls 'vertical-align' on the '<td>' elements.
  • textOverflow ('wrap' or 'truncate'): How body cell text behaves when it exceeds the column width. 'wrap' lets text wrap and the row grow taller; 'truncate' clips with an ellipsis (default-rendered cells show a tooltip on hover when truncated). Header cells always truncate.
  • children (ReactNode): Children mode: render TableRow/TableCell directly instead of using data-driven rendering.
  • xstyle (StyleXStyles): StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.

Props typed as React nodes, render functions, event handlers, refs, or StyleX styles are documented for Astryx parity but cannot be serialized directly from Python unless the wrapper adapts them.

See Astryx component docs: https://astryx.atmeta.com/components/Table.

Notes

Row checkbox selection is optional. Leave selects empty for no checkbox column, use "single" or "multiple" to enable selection.

Attributes

attributeselected
= t.List(t.Unicode(), default_value=[]).tag(sync=True)
attributeselects
= t.Unicode('').tag(sync=True)
attributesort_key
= t.Unicode('').tag(sync=True)
attributesort_direction
= t.Unicode('').tag(sync=True)
attributesortable
= t.Bool(False).tag(sync=True)
attributeselect_all_label
= t.Unicode('Select all rows').tag(sync=True)
attributerowslist[dict[str, Any]]

Current normalized Astryx table rows.

attributecolumnslist[dict[str, Any]]

Current Astryx table column definitions.

attributerow_keystr

Current row id property used by Astryx Table.

Functions

constructor__init__(rows=(), columns=None, *, row_key='id', selected=(), selects='', sortable=False, sort_key='', sort_direction='', select_all_label='Select all rows', width=None, height=None, density=None, dividers=None, striped=None, hover=None, vertical_align=None, text_overflow=None, **props) -> None
paramrowsIterable[Any]
= ()

Rows or records rendered by the component.

paramcolumnsIterable[Any] | Mapping[str, Any] | None
= None

Grid or table column definition.

paramrow_keystr | None
= 'id'

Row id field. Use None to generate notebook-local row ids.

paramselectedIterable[Any]
= ()

Initially selected row ids.

paramselectsstr
= ''

Selection mode. Use "" for no checkbox column.

paramsortablebool
= False

Whether table columns should be sortable by default.

paramsort_keystr
= ''

Initially sorted table column key.

paramsort_directionstr
= ''

Initial sort direction. Use "" for unsorted.

paramselect_all_labelstr
= 'Select all rows'

Accessible label for the select-all checkbox.

paramwidthint | float | str | None
= None

CSS width. Numbers are normalized by anylumino where supported.

paramheightint | float | str | None
= None

CSS height. Numbers are normalized by anylumino where supported.

paramdensitystr | None
= None

Compact, balanced, or spacious row density.

paramdividersstr | None
= None

Row, column, grid, or no divider treatment.

paramstripedbool | None
= None

Whether alternating rows receive a background wash.

paramhoverbool | None
= None

Whether rows highlight on pointer hover.

paramvertical_alignstr | None
= None

Body-cell vertical alignment.

paramtext_overflowstr | None
= None

Wrap or truncate overflowing cell text.

parampropsAny
= {}

Returns

None
funcset_rows(rows, *, columns=None, row_key=None) -> None

Replace table rows from raw row mappings, sequences, or scalar values.

paramrowsIterable[Any]
paramcolumnsIterable[Any] | Mapping[str, Any] | None
= None
paramrow_keystr | None
= None

Returns

None
funcappend_row(row, *, row_key=None) -> str

Append one raw row and return its normalized row id.

paramrowAny
paramrow_keystr | None
= None

Returns

str
funcprepend_row(row, *, row_key=None) -> str

Prepend one raw row and return its normalized row id.

paramrowAny
paramrow_keystr | None
= None

Returns

str
funcupdate_row(row_value, values) -> None

Update cells by row id, preserving selection if the id changes.

Row ids must remain unique after conversion to strings. An invalid update raises ValueError without changing rows or selection.

paramrow_valueAny
paramvaluesAny

Returns

None
funcremove_row(row_value) -> None

Remove an existing row by row id.

paramrow_valueAny

Returns

None
funcon_select(callback, remove=False) -> None

Register or unregister a callback for table selection changes.

paramcallbackCallable[[Table], None]
paramremovebool
= False

Returns

None
funcon_sort(callback, remove=False) -> None

Register or unregister a callback for table sort changes.

paramcallbackCallable[[Table], None]
paramremovebool
= False

Returns

None

On this page