render.DataTable

render.DataTable(self, data, *, width='fit-content', height='500px', summary=True, filters=False, editable=False, selection_mode='none', row_selection_mode='deprecated')

Holds the data and options for a data_frame output, for a spreadsheet-like view.

Parameters

data: pd.DataFrame | PandasCompatible

A pandas DataFrame object, or any object that has a .to_pandas() method (e.g., a Polars data frame or Arrow table).

width: str | float | None = ‘fit-content’

A maximum amount of vertical space for the data table to occupy, in CSS units (e.g. "400px") or as a number, which will be interpreted as pixels. The default is fit-content, which sets the table’s width according to its contents. Set this to 100% to use the maximum available horizontal space.

height: str | float | None = ‘500px’

A maximum amount of vertical space for the data table to occupy, in CSS units (e.g. "400px") or as a number, which will be interpreted as pixels. If there are more rows than can fit in this space, the table body will scroll. Set the height to None to allow the table to grow to fit all of the rows (this is not recommended for large data sets, as it may crash the browser).

summary: bool | str = True

If True (the default), shows a message like “Viewing rows 1 through 10 of 20” below the grid when not all of the rows are being shown. If False, the message is not displayed. You can also specify a string template to customize the message, containing {start}, {end}, and {total} tokens. For example: "Viendo filas {start} a {end} de {total}".

filters: bool = False

If True, shows a row of filter inputs below the headers, one for each column.

editable: bool = False

If True, allows the user to edit the cells in the grid. When a cell is edited, the new value is sent to the server for processing. The server can then return a new value for the cell, which will be displayed in the grid.

selection_mode: SelectionModeInput = ‘none’

Single string or a set/list/tuple of string values to define possible ways to select data within the data frame.

Supported values: * Use "none" to disable any cell selections or editing. * Use "row" to allow a single row to be selected at a time. * Use "rows" to allow multiple rows to be selected by clicking on them individually.

Resolution rules: * If "none" is supplied, all other values will be ignored. * If both "row" and "rows" are supplied, "row" will be dropped (supporting "rows").

row_selection_mode: Literal[‘deprecated’] = ‘deprecated’

Deprecated. Please use mode={row_selection_mode}_row instead.

Returns

Type Description
An object suitable for being returned from a @render.data_frame-decorated output function.

See Also