feat(data_table): support custom label and initial column visibility in DataTableColumnToggle#466
Conversation
…in DataTableColumnToggle Adds a `label:` option (defaults to "Columns") so the trigger text can be localized/customized, and reads `:visible` per column so a column can start hidden (checkbox unchecked). Also adds `checked:` styling to the checkbox. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="gem/test/ruby_ui/data_table_column_toggle_test.rb">
<violation number="1" location="gem/test/ruby_ui/data_table_column_toggle_test.rb:38">
P3: The assertion `assert_equal 1, output.scan("checked class=").length` ties the test to attribute ordering in the rendered HTML. If someone moves `class:` above `checked:` in the component template, this test breaks even though the checked/unchecked behavior is unchanged. Consider a regex that matches `checked` as a standalone boolean attribute regardless of position, e.g. `output.scan(/\bchecked(?:\s|>)/).length` which won't match `checked:` inside class values but will match the boolean `checked` attribute.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
The
Worth having the controller read the initial checkbox states on |
…bleColumnToggle Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… in column toggle test Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What & why
DataTableColumnTogglehardcodes the trigger label to"Columns"and always renders every column as initially visible. This adds two small, backward-compatible options:label:(default"Columns") — localize or rename the trigger button.visible:key (defaulttrue) — let a column start hidden (checkbox unchecked) on first render.It also adds
checked:utility classes to the checkbox so the selected state reads clearly in light and dark themes.Usage
Before / after
Notes
labeldefaults to"Columns"andvisibledefaults totrue, so existing call sites are unchanged.mcp/data/registry.jsonrebuilt for the updated component.