{#- chirp-ui: Table component Responsive table with header configuration and row helper. Usage: from "chirpui/table.html" import table, row call table(headers=["Name", "Email", "Role"]) row("Alice", "alice@example.com", "Admin") row("Bob", "bob@example.com", "User") end Per-column alignment: call table(headers=["Name", "Status", "Count"], align=["left", "center", "right"]) row("Alice", "Active", "42") end Column widths (CSS values or proportions): call table(headers=["Name", "Status"], widths=["2fr", "1fr"]) Slots: caption (table caption), row_actions (header cell for actions column). Sortable headers: call table(headers=["Name", "Email"], sortable=true, sort_url="/users", hx_target="#user-table") row(user.name, user.email) end Row with actions: pass row_actions(...) as last cell when actions_header=true Sticky header: call table(headers=[...], sticky_header=true) -#} {% def table(headers=none, sortable=false, sort_url=none, hx_target=none, striped=false, sticky_header=false, actions_header=false, align=none, widths=none, compact=false, cls="") %}
| {{ header }} | {% end %} {% if actions_header %}{% end %} |
|---|