Skip to main content
The Dataframe component displays and edits tabular data in a spreadsheet format.

Basic usage

Constructor

pd.DataFrame | np.ndarray | list | dict | str | Callable | None
default:"None"
Default data. Accepts pandas DataFrame, numpy array, list of lists, dict, or CSV filepath
list[str] | None
default:"None"
Column headers. If None, headers are inferred from data
int | None
default:"None"
Initial number of rows to display
int | None
default:"None"
Initial number of columns. Defaults based on data
str | Sequence[str]
default:"'str'"
Column datatypes. Can be:
  • Single string: "str", "number", "bool", "date", "markdown"
  • List per column: ["str", "number", "bool"]
  • "auto" - Automatically infer types
Literal['pandas', 'numpy', 'array', 'polars']
default:"'pandas'"
Format passed to function:
  • "pandas" - pandas DataFrame
  • "numpy" - numpy array
  • "array" - Python list of lists
  • "polars" - Polars DataFrame
bool | None
default:"None"
Whether users can edit the dataframe
int | str
default:"500"
Maximum height with scrollbar if needed
bool
default:"False"
Whether text in cells should wrap
bool
default:"True"
Enable line breaks in markdown cells

Events

  • change - Triggered when data changes
  • input - Triggered on input
  • select - Triggered when cell is selected
  • edit - Triggered when cell is edited

Examples

With pandas

With specific datatypes