Reactable

Reactable(
    self,
    data,
    columns=None,
    column_groups=None,
    rownames=False,
    group_by=None,
    sortable=True,
    resizable=None,
    filterable=None,
    searchable=None,
    pagination=None,
    default_col_def=None,
    default_sort_order='asc',
    default_sorted=None,
    default_page_size=None,
    show_page_size_options=None,
    page_size_options=lambda: [10, 25, 50, 100](),
    pagination_type='numbers',
    show_pagination=None,
    show_page_info=None,
    min_rows=None,
    paginate_sub_rows=None,
    details=None,
    default_expanded=None,
    selection=None,
    on_click=None,
    highlight=False,
    outlined=None,
    bordered=False,
    borderless=False,
    striped=False,
    compact=False,
    wrap=True,
    show_sort_icon=None,
    show_sortable=None,
    class_=None,
    style=None,
    row_class=None,
    row_style=None,
    full_width=True,
    width=None,
    height=None,
    theme=None,
    language=None,
    meta=None,
    element_id=None,
    static=None,
    dataKey=None,
)

A reactive table.

Parameters

Name Type Description Default
data dict[str, list[Any]] | DataFrameLike The data. required
columns list[Column] | None Named list of column definitions. None
column_groups list[ColGroup] | None List of column group definitions. None
sortable bool Whether to enable sorting. Defaults to True. True
resizable bool | None Whether to enable column resizing. None
filterable bool | None Whether to enable column filtering. None
searchable bool | None Whether to enable global table searching. None
pagination bool | None Whether to enable pagination. None
default_col_def InitVar[Column | None] Default column definition used by every column. None
default_sort_order InitVar[Literal['asc', 'desc']] Default sort order. Either “asc” for ascending order or “desc” for descending order. Defaults to “asc”. 'asc'
default_sorted list[str] | dict[str, str] | None List of column names to sort by default. Or to customize sort order, a dictionary mapping column names to “asc” or “desc”. None
default_page_size int | None Default page size for the table. Defaults to 10. None
show_page_size_options bool | None Whether to show page size options. None
pagination_type Literal['numbers', 'jump', 'simple'] Pagination control to use. Either “numbers” for page number buttons (the default), “jump” for a page jump, or “simple” to show ‘Previous’ and ‘Next’ buttons only. 'numbers'
show_pagination bool | None Whether to show pagination. None
show_page_info bool | None Whether to show page info. None
min_rows int | None Minimum number of rows to show per page. Defaults to 1. None
paginate_sub_rows bool | None When rows are grouped, paginate sub rows. Defaults to False. None
details InitVar[JS | Column | None] Additional content to display when expanding a row. None
default_expanded bool | None Whether to expand all rows by default. None
selection Literal['multiple', 'single'] | None Enable row selection. Either “multiple” or “single” for multiple or single row selection. To customize the selection column, use ".selection" as the column name. None
on_click Literal['expand', 'select'] | JsFunction | None Action to take when clicking a cell. Either “expand” to expand the row, “select” to select the row, or a JS function that takes a row info object as an argument. None
highlight bool Whether to highlight table rows on hover. False
outlined bool | None Whether to add borders around the table. None
bordered bool Whether to add borders around the table and every cell. False
borderless bool Whether to remove inner borders from table. False
striped bool Whether to add zebra-striping to table rows. False
compact bool Whether to make tables more compact. False
wrap InitVar[bool] Whether to enable text wrapping. If True (the default), long text will be wrapped to multiple lines. If False, text will be truncated to fit on one line. True
show_sort_icon bool | None Whether to show a sort icon when sorting columns. None
show_sortable bool | None Whether to show an indicator on sortable columns. None
class_ InitVar[str | list[str] | None] Additional CSS classes to apply to the table. None
style CssRules | None Inline styles to apply to the table. None
row_class InitVar[list[str] | Callable[RowIndx, list[str]] | None] Additional CSS classes to apply to table rows. None
row_style CssRules | Callable[RowIndx, dict[str, str]] | None Inline styles to apply to table rows. None
full_width InitVar[bool] Whether to stretch the table to fill the full width of its container. Defaults to True. True
width int | None Width of the table in pixels. Defaults to “auto” for automatic sizing. None
height int | None Height of the table in pixels. Defaults to “auto” for automatic sizing. None
theme Theme | None Theme options for the table, specified by Theme(). Defaults to the global reactable.theme option. None
language str | None Language options for the table, specified by Language(). Defaults to the global reactable.language option. None
meta dict[str, Any] | None Custom metadata to pass to JavaScript render functions or style functions. None
element_id str | None Element ID for the widget None

Examples

from reactable import Reactable, Column, ColFormat
from reactable.data import cars_93

Reactable(
    cars_93[:, ["manufacturer", "model", "price"]],
    columns = {
        "price": Column(
            name="Price",
            format=ColFormat(prefix="$", digits=2),
        ),
    },
    filterable=True
)