Repository navigation
[Feature] Table: match shadcn (Base UI + vega) - #652
Merged
Merged
Conversation
Fix TableFooter's class string: it held one malformed token (`font-medium[& amp;>tr]:last:border-b-0`), so the footer was not font-medium and its last row kept a bottom border. Match vega on the rest: TableHead uses text-foreground, TableHead and TableCell get whitespace-nowrap (wide tables now scroll in their container instead of wrapping cells), the unused [&>[role=checkbox]]:translate-y-[2px] goes away, TableRow is highlighted while a control inside it is expanded, and the container is overflow-x-auto. Every part now carries its shadcn data-slot. Adds the audit map (with the drift baseline) and fixtures, updates the docs to shadcn's examples (with footer, badges, actions) and rebuilds the MCP registry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 16 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
- A caller's data-slot now replaces each part's default instead of being joined to it by Base#mix (shared TableSlot module, same rule as Input) - TableHead and TableCell also drop the right padding for a cell holding RubyUI's native checkbox ([data-slot=checkbox]), which has no role attribute Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings Table in line with shadcn's Base UI table (vega style).
The audit on
mainfound a broken footer and several class differences:TableFooterhad one malformed class token,font-medium[& amp;>tr]:last:border-b-0(an escaped&and a missing space). Tailwind generated neither rule, so the footer text wasn't medium weight and the last footer row kept its bottom border.TableHeadusedtext-muted-foreground. vega usestext-foreground.TableHeadandTableCelllackedwhitespace-nowrap. In a 300px container RubyUI wrapped "Credit Card" and "Bank Transfer" onto two lines (table 264px tall), while shadcn keeps each cell on one line and scrolls the container sideways.TableHeadandTableCellcarried[&>[role=checkbox]]:translate-y-[2px], which vega doesn't have.TableRowlackedhas-aria-expanded:bg-muted/50, so a row didn't stay highlighted while a menu inside it was open.data-slot.Cells no longer wrap
TableHeadandTableCellare nowwhitespace-nowrap, as in shadcn. A table wider than its container scrolls horizontally inside it instead of wrapping its text. For a column that should wrap (long descriptions, for example), passclass: "whitespace-normal"to that cell.What changed
Tabledivisdata-slot="table-container"withoverflow-x-auto(same computed overflow as before); the<table>isdata-slot="table"TableHeader,TableBody,TableCaptiondata-slotTableFooterborder-t bg-muted/50 font-medium [&>tr]:last:border-b-0,data-slot="table-footer"TableRowhas-aria-expanded:bg-muted/50,data-slot="table-row"TableHeadtext-foreground whitespace-nowrap, no translate, checkbox padding rule,data-slot="table-head"TableCellwhitespace-nowrap, no translate, checkbox padding rule,data-slot="table-cell"The translate never applied to RubyUI's own checkbox: it targets a direct child with a
role="checkbox"attribute, and RubyUI's checkbox is a native<input>(inside adivin the DataTable examples). I checked the DataTable docs in the browser after the change: the checkboxes sit centered in their rows (within 1px) with no transform.The docs now follow shadcn's examples: with footer (the footer uses
TableCell, as shadcn's does, instead ofTableHead), with badges, and with actions, where the row stays highlighted while its dropdown menu is open. The component had no audit map or fixtures, so this PR addsaudit/component_map/table.yml(with the drift baseline) andaudit/fixtures/table/. The MCP registry is rebuilt.A caller's
data-slotreplaces a part's default instead of being joined to it (Table(data: {slot: "x"})rendersdata-slot="x"), the same rule asInput. The parts share that logic through aTableSlotmodule.TableHeadandTableCellalso drop their right padding when they hold RubyUI's checkbox ([&:has([data-slot=checkbox])]:pr-0, vega's rule for the aria base): therole=checkboxrule alone never matched RubyUI's native input. Codex and Cubic raised both points during review.Screenshots
Audit fixture (shadcn's "With Footer" example plus a selected row), 1280×800, same strings on both sides.
Audit on main
Audit on this branch
Follow-ups
docs/app/views/docs/data_table.rb:126putsDataTableSelectAllCheckboxstraight inTableHead, while the body cells wrap theirs inflex justify-center. So the header checkbox sits on the left and the row checkboxes are centered, as they already were onmain.Test steps
cd gem && bundle exec rake(tests + standardrb).cd docs && bin/rails db:test:prepare test.cd mcp && bundle exec rake; the registry is up to date.bin/devand open/docs/table: the footer is medium weight with no bottom border; narrow the window and the tables scroll instead of wrapping; open a row's menu in "With actions" and the row stays highlighted.🤖 Generated with Claude Code