[REF-2253] High level API for rx.table
Currently the API for rx.table is quite verbose. We should explore a way to make a high level API for it.
Instead of
rx.table.root(
rx.table.header(
rx.table.row(
rx.table.column_header_cell("Full name"),
rx.table.column_header_cell("Email"),
rx.table.column_header_cell("Group"),
),
),
rx.table.body(
rx.table.row(
rx.table.row_header_cell("Danilo Sousa"),
rx.table.cell("[email protected]"),
rx.table.cell("Developer"),
),
rx.table.row(
rx.table.row_header_cell("Zahra Ambessa"),
rx.table.cell("[email protected]"),
rx.table.cell("Admin"),
),
rx.table.row(
rx.table.row_header_cell("Jasper Eriksson"),
rx.table.cell("[email protected]"),
rx.table.cell("Developer"),
),
),
)
maybe we can have something like
rx.table(
[
["Full name", "Email", "Group"],
["Danilo Sousa", "Zahra Ambessa", "Jasper Eriksson"],
...
],
)
When designing this, we need to think carefully about how it will work with State vars (and using rx.foreach for dynamic row values).
From SyncLinear.com | REF-2253
Let me try working on this.
Looking at the documentation, the granular approach gives a lot of flexibility to the design of the table UI. Are you suggesting the high-level API will generate a default style without a custom design or should custom designs be supported?
@Ifechukwu001 Agreed that we should keep the current table API. Was mainly wondering if there's improvements we could make for a high-level API on top of it that would have a built in opinionated design/styling.
Similar to how for select we have high level and low level.
The rx.table.root approach would still be there for full control, but perhaps we could have an rx.table component that could take in something simpler. I don't have a final API in mind at the moment though.
Alright, let me work on a prototype, then we can fine-tune it when I make the PR
I think we can hold off on this - the original API gives good flexibility and we will add recipes / tutorials to the docs on how to do common operations like working with a data frame.