An interactive table component designed for viewing, editing, and exploring large datasets in Dash applications.
npx @tessl/cli install tessl/npm-dash--table@6.0.0Dash Table is an interactive table component specifically designed for the Dash ecosystem, providing comprehensive functionality for viewing, editing, and exploring large datasets. Built from scratch in React.js and TypeScript, it renders with standard semantic HTML table markup making it accessible, responsive, and easy to style.
The component offers a rich feature set including data filtering, sorting, editing, cell selection, row operations, conditional formatting, and pagination, all through a highly customizable API. It supports various data types, custom cell renderers, dropdown menus, and advanced styling options.
dash-tableIn Python Dash applications, dash-table is included with the main dash package:
pip install dashFor JavaScript/React development:
npm install dash-table# Primary usage in Python Dash applications
from dash import dash_table
# or
import dash_table
from dash_table import DataTableFor JavaScript/React development:
import { DataTable } from 'dash-table';# Python usage in Dash application
import dash_table
dash_table.DataTable(
id='table',
columns=[
{"name": "Name", "id": "name"},
{"name": "Age", "id": "age", "type": "numeric"},
{"name": "City", "id": "city"}
],
data=[
{"name": "Alice", "age": 30, "city": "New York"},
{"name": "Bob", "age": 25, "city": "London"},
{"name": "Charlie", "age": 35, "city": "Paris"}
]
)dash_table.DataTable(
id='interactive-table',
columns=[
{"name": "Product", "id": "product", "editable": True},
{"name": "Price", "id": "price", "type": "numeric", "format": {"specifier": "$,.0f"}},
{"name": "Stock", "id": "stock", "type": "numeric"}
],
data=[
{"product": "Widget A", "price": 19.99, "stock": 100},
{"product": "Widget B", "price": 29.99, "stock": 50}
],
editable=True,
sort_action="native",
sort_mode="multi"
)Dash Table follows a declarative configuration approach where all functionality is controlled through properties passed to the DataTable component. The component handles data management, user interactions, and rendering internally while exposing a comprehensive API for customization.
Configure data structure, column definitions, and data types. Handle data validation, coercion, and transformation.
dash_table.DataTable(
data=[{"id": 1, "name": "John", "active": True}],
columns=[
{"name": "ID", "id": "id", "type": "numeric"},
{"name": "Name", "id": "name", "type": "text", "editable": True},
{"name": "Active", "id": "active", "type": "text", "presentation": "dropdown"}
]
)Enable user interactions including cell/row/column selection, editing, filtering, sorting, and pagination.
dash_table.DataTable(
cell_selectable=True,
row_selectable="multi",
column_selectable="single",
editable=True,
filter_action="native",
sort_action="native",
page_action="native",
page_size=50
)Control visual appearance through CSS styles, conditional formatting, fixed columns/rows, and responsive design.
dash_table.DataTable(
style_table={'overflowX': 'auto'},
style_cell={'textAlign': 'left', 'padding': '10px'},
style_data_conditional=[
{
'if': {'row_index': 'odd'},
'backgroundColor': 'rgb(248, 248, 248)'
}
],
fixed_columns={'headers': True, 'data': 1}
)Create dropdown menus within cells, configure tooltips, and handle user input validation.
dash_table.DataTable(
dropdown={
'status': {
'options': [
{'label': 'Active', 'value': 'active'},
{'label': 'Inactive', 'value': 'inactive'}
]
}
},
tooltip_data=[
{
'status': {'value': 'Current status of the item', 'type': 'markdown'}
}
]
)Export table data to CSV/Excel formats, handle copy/paste operations, and manage data persistence.
dash_table.DataTable(
export_format="xlsx",
export_columns="visible",
export_headers="display",
include_headers_on_copy_paste=True,
persistence=True,
persisted_props=['sort_by', 'filter_query', 'page_current']
)Format numbers, dates, and text using the built-in Format system and localization support.
# Python formatting utilities
from dash_table import FormatTemplate
from dash_table.Format import Format, Group, Scheme, Sign
dash_table.DataTable(
columns=[
{
"name": "Price",
"id": "price",
"type": "numeric",
"format": FormatTemplate.money(2)
},
{
"name": "Change",
"id": "change",
"type": "numeric",
"format": FormatTemplate.percentage(1)
}
]
)# Dash framework integration properties
dash_table.DataTable(
id='my-table', # Required for Dash callbacks
# loading_state managed automatically by Dash
# setProps managed automatically by Dash
data=[{"name": "John", "age": 30}],
columns=[
{"name": "Name", "id": "name"},
{"name": "Age", "id": "age", "type": "numeric"}
]
)Core Integration Properties:
# Component identifier for Dash callbacks
id: str
# Loading state object from dash-renderer
loading_state: dict = {
'is_loading': bool, # Whether component is currently loading
'prop_name': str, # Which property is loading
'component_name': str # Name of loading component
}
# Dash callback function (internal - managed automatically)
setProps: callableKey default values for DataTable configuration:
page_action: 'native'page_current: 0page_size: 250cell_selectable: Truerow_selectable: Falsecolumn_selectable: Falseeditable: Falsefill_width: Truevirtualization: Falsefilter_action: 'none'sort_action: 'none'sort_mode: 'single'export_format: 'none'export_columns: 'visible'include_headers_on_copy_paste: Falsetooltip_delay: 350 (milliseconds)tooltip_duration: 2000 (milliseconds)persistence_type: 'local'markdown_options.link_target: '_blank'markdown_options.html: Falsestyle_as_list_view: Falsemerge_duplicate_headers: False (when not specified)The following properties are available but not covered in detail in other sections:
# Previous state of data (read-only)
data_previous: list[dict]
# Unix timestamp when data was last edited (read-only)
data_timestamp: int
# Whether the active cell is in focused state (read-only)
is_focused: bool# Allow users to delete rows via 'x' button
row_deletable: bool = False# Embed CSS selectors and rules directly
css: list[dict] = [
{"selector": ".dash-spreadsheet", "rule": 'font-family: "monospace"'}
]# Table-wide localization formatting
locale_format: dict = {
'symbol': ['$', ''], # Currency prefix/suffix
'decimal': '.', # Decimal separator
'group': ',', # Thousands separator
'grouping': [3], # Grouping pattern
'numerals': [...], # Number replacements 0-9
'percent': '%', # Percentage symbol
'separate_4digits': True # Separate 4-digit numbers
}# Merge duplicate column headers automatically
merge_duplicate_headers: bool = False
# Style table as list view without column borders
style_as_list_view: bool = False