feat(data_table): support custom label and initial column visibility in DataTableColumnToggle
Merged
PI
4mo ago+54+54+01234567890123456789-10-10-01234567890123456789
What & why
DataTableColumnToggle hardcodes 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.- per-column
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
render RubyUI::DataTableColumnToggle.new(
label: "Colunas",
columns: [
{key: :email, label: "Email"},
{key: :salary, label: "Salary", visible: false}
]
)
Before / after
| Before | After |
|---|---|
Notes
- Backward compatible:
labeldefaults to"Columns"andvisibledefaults totrue, so existing call sites are unchanged. mcp/data/registry.jsonrebuilt for the updated component.