Skip to content

Table: rows and columns with per-column alignment, row rules and a rounded container #20

Closed

Description

@samitbasu

Requested by the user. A table in the style of shadcn's Table / Data Table:

  • a rounded, bordered container;
  • a header row;
  • rows separated by hairlines;
  • columns whose widths line up across rows;
  • per-column alignment (the first column left, the last right, numbers right);
  • optional hover and selected row states.

Design questions

  • Column alignment across rows. A grid with column tracks lines the columns up. But row rules and row hover need a node per row, and taffy has no subgrid. Options:

    • every row is its own grid with the same track list (simple; widths only agree for fixed or fr tracks, not content-sized ones);
    • one grid with row-spanning background nodes behind each row for hover and rules (content-sized columns work);
    • a library helper that measures column widths once and shares them.

    Decide with a spike.

  • Library helper or pattern. It could be a documented pattern built from existing classes, or a small prim::table builder (columns(&[Column { track, align }]), header, row(key, …)). Prefer the pattern unless the column-sharing problem needs library code.

  • Scrolling and long tables. These depend on M5 (scroll) and M8 (virtual lists); a sticky header is out of scope (no position: sticky).

Where

After M4c, as its own item, probably alongside M5 so a long table can scroll. Add an example, and use it in chat_shell where tabular data appears.

Related: #18 item 26 (the grouped two-column form in chat_shell's details panel, which needs no table).

Activity

  1. samitbasu commented on Nov 11, 2026

    @samitbasu
    OwnerAuthor

    From the port: striped key–value grids want the stripe across the whole row, gaps included; per-cell backgrounds leave a hole at gap_x (CSS-faithful). A row-level paint (or display: contents row wrappers, which taffy lacks) belongs with this table work.

  2. samitbasu commented on Nov 12, 2026

    @samitbasu
    OwnerAuthor

    Correction to my earlier comment: striping a full grid row needs neither a row-paint hook nor display: contents. The CSS idiom works as is: one col_span_full().row_start(r) item per striped row, declared before the explicitly placed cells. It's documented with a tested example in the crate docs (PR "docs: striped grid rows"). Table work here can build on it.

  3. added
    consumer
    v0.1
    and removed
    consumer
    on Nov 14, 2026
  4. samitbasu commented on Nov 16, 2026

    @samitbasu
    OwnerAuthor

    Design decided (user, 2026-11-15):

    • T1: a builder, b.table(key).columns([..]).header(..).rows(&items, key_fn, |row, item| ..); the whole table is one grid with row bands; a wrong cell count is a debug panic.
    • T2: per-column Start/Center/End alignment.
    • T3: hover always; opt-in, app-owned single selection with arrow keys.
    • T4: no virtualization or sticky header in v0.1.
    • T5: cells hold any content.
    • T6: a footer row, no caption.
    • T7: Table/Row/ColumnHeader/Cell roles with indices.
    • T8, the look: rendered next.
  5. samitbasu commented on Nov 16, 2026

    @samitbasu
    OwnerAuthor

    Look decided (user, 2026-11-15): (a), shadcn's Table as it ships (row rules, plain header, hover muted/50, selected muted, a muted/50 footer). The fills and rules are TableStyle fields, so the muted-header and zebra variants stay one preset change away.

  6. samitbasu commented on Nov 16, 2026

    @samitbasu
    OwnerAuthor

    T3 revised (user, 2026-11-16): rows aren't focusable, as in shadcn. Selection is app state shown as the row fill, set by a row click or a checkbox cell; there's no row keyboard navigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    v0.1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions