| Crates.io | dioxus-tabular |
| lib.rs | dioxus-tabular |
| version | 0.3.0 |
| created_at | 2025-10-30 15:28:28.637615+00 |
| updated_at | 2025-11-21 10:51:32.384103+00 |
| description | Type-safe and composable table framework for Dioxus |
| homepage | https://github.com/ryo33/dioxus-tabular |
| repository | https://github.com/ryo33/dioxus-tabular |
| max_upload_size | |
| id | 1908428 |
| size | 212,290 |
Type-safe and composable table framework for Dioxus. Define self-contained columns with rendering, filtering, and sorting logic that work independently of table data types and components.
# for Dioxus 0.6.3
dioxus-tabular = "0.1"
# for Dioxus 0.7.0
dioxus-tabular = "0.2"
dioxus-tabular is a Dioxus-native framework for building structured, declarative, and strongly-typed table UIs.
Instead of configuring your table with dynamic descriptors or ad-hoc data models, you define columns as typed components that don't depend on the actual table data type or table component.
Each column owns its own rendering, filtering, and sorting logic — and can hold local reactive state via Signal.
This approach may seem more verbose initially, but it enables:
Row, GetRowData, TableColumn)| Trait / Struct | Description |
|---|---|
Row |
Defines the unique key and identity of each row. |
GetRowData<T> |
Provides access to the data of the row by a specific type. |
TableColumn |
Describes how a single column renders, filters, and compares rows. |
Columns |
A composed collection of TableColumns, implemented for tuples. |
Tables support declarative multi-column sorting with priority control:
TableColumn::compare()Columns can implement custom filtering logic:
TableColumn::filter() methodControl which columns are displayed and in what order:
hide_column(), show_column() - Toggle column visibilitymove_to(), swap_columns() - Change column positionsmove_forward(), move_backward() - Move columns incrementallyreset_column_order() - Restore default order and visibilityAccess these methods through TableContextData or ColumnContext.
export feature)You can export table data with your custom exporter implementation. Enable the export feature, and implement the SerializableColumn trait for your columns and the Exporter trait for your exporter.
See the example for more details.
You can define types and implement traits as follows:
Rows:
User implements Row, GetRowData<UserId> and GetRowData<UserName>AccessLog implements Row, GetRowData<AccessLogId>, GetRowData<Timestamp> and GetRowData<UserId>Columns:
UserIdColumn implements TableColumn<T> for every T where GetRowData<UserId>UserNameColumn implements TableColumn<T> for every T where GetRowData<UserName>AccessLogIdColumn implements TableColumn<T> for every T where GetRowData<AccessLogId>TimestampColumn implements TableColumn<T> for every T where GetRowData<Timestamp>And, you define a simple table component like the following:
#[component]
pub fn SimpleTable<R: Row, C: Columns<R>>(rows: ReadSignal<Vec<R>>, columns: C) -> Element {
let table_context = TableContext::use_table_context(columns.column_names());
rsx! {
table {
thead {
tr { {columns.render_headers(table_context)} }
}
tbody {
for row in rows.iter() {
tr { key: "{row.key().into()}",
{columns.render_columns(table_context, &row, vec![])}
}
}
}
}
}
}
and another one:
#[component]
pub fn FancyTable<R: Row, C: Columns<R>>(rows: ReadSignal<Vec<R>>, columns: C) -> Element {
// Another table component with different styling or features than the above one.
// ...
}
You can then render various kinds of tables with different column combinations:
let users: Vec<User> = ...;
let access_logs: Vec<AccessLog> = ...;
rsx! {
// Simple table with two columns for showing user ids and names.
SimpleTable { rows: users, columns: (UserIdColumn, UserNameColumn) }
// Same data and columns, but with different styling or features than the above one.
FancyTable { rows: users, columns: (UserIdColumn, UserNameColumn) }
// Table for access logs. The UserIdColumn is reusable across different table types.
SimpleTable { rows: access_logs, columns: (AccessLogIdColumn, TimestampColumn, UserIdColumn) }
}
Also, if you implement filtering and sorting logic in the columns, any tables have sorting and filtering features without any additional code to each table.
MIT or Apache 2.0 at your option.