feat(data_table): support custom label and initial column visibility in DataTableColumnToggle

Merged
PI
4mo ago
+54-10

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 (default true) — 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

BeforeAfter
imageimage

Notes

  • Backward compatible: label defaults to "Columns" and visible defaults to true, so existing call sites are unchanged.
  • mcp/data/registry.json rebuilt for the updated component.