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_keystrCurrent 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) -> NoneparamrowsIterable[Any]= ()Rows or records rendered by the component.
paramcolumnsIterable[Any] | Mapping[str, Any] | None= NoneGrid 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= FalseWhether 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= NoneCSS width. Numbers are normalized by anylumino where supported.
paramheightint | float | str | None= NoneCSS height. Numbers are normalized by anylumino where supported.
paramdensitystr | None= NoneCompact, balanced, or spacious row density.
paramdividersstr | None= NoneRow, column, grid, or no divider treatment.
paramstripedbool | None= NoneWhether alternating rows receive a background wash.
paramhoverbool | None= NoneWhether rows highlight on pointer hover.
paramvertical_alignstr | None= NoneBody-cell vertical alignment.
paramtext_overflowstr | None= NoneWrap or truncate overflowing cell text.
parampropsAny= {}Returns
Nonefuncset_rows(rows, *, columns=None, row_key=None) -> NoneReplace table rows from raw row mappings, sequences, or scalar values.
paramrowsIterable[Any]paramcolumnsIterable[Any] | Mapping[str, Any] | None= Noneparamrow_keystr | None= NoneReturns
Nonefuncappend_row(row, *, row_key=None) -> strAppend one raw row and return its normalized row id.
paramrowAnyparamrow_keystr | None= NoneReturns
strfuncprepend_row(row, *, row_key=None) -> strPrepend one raw row and return its normalized row id.
paramrowAnyparamrow_keystr | None= NoneReturns
strfuncupdate_row(row_value, values) -> NoneUpdate 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_valueAnyparamvaluesAnyReturns
Nonefuncremove_row(row_value) -> NoneRemove an existing row by row id.
paramrow_valueAnyReturns
Nonefuncon_select(callback, remove=False) -> NoneRegister or unregister a callback for table selection changes.
paramcallbackCallable[[Table], None]paramremovebool= FalseReturns
Nonefuncon_sort(callback, remove=False) -> NoneRegister or unregister a callback for table sort changes.
paramcallbackCallable[[Table], None]paramremovebool= FalseReturns
None