RRUI-005 · Table · Borders
bordered: couples exterior and cell bordersSetting bordered: true draws an outer frame and vertical borders on every header/body cell. Hosts that only want a card-like exterior outline (common for dense data tables) cannot opt into the outer border without the gridlines.
bordered: is documented/used as “show borders,” but the implementation wires both wrapper/table outline and per-cell border-x. There is no first-class way to request exterior-only framing.
| Component | RapidRailsUI::Table::Component |
|---|---|
| Trigger |
rui_table(..., bordered: true, shape: :rounded) (or square) |
| Symptom | Wanted: single outer border. Got: outer border plus vertical cell borders on every column. |
| API gap | No bordered: :outline / cell_borders: split — hosts fall back to bordered: false + manual class: on the wrapper. |
<%= rui_table(@lots, bordered: true, shape: :rounded, hoverable: true) do |table| %>
<% table.column(:lot, label: "Lot") %>
<% table.column(:breed, label: "Breed") %>
<% table.column(:status, label: "Status") %>
<% end %>
border border-zinc-200, and each th/td gets border-x … (grid look).border-b on rows, without vertical cell rules.def self.wrapper_classes(..., bordered: false, ...)
classes << BORDERED_CLASSES if bordered && shape == :rounded
end
def self.table_classes(..., bordered:, shape: :square, ...)
classes << BORDERED_CLASSES if bordered && shape != :rounded
end
BORDERED_CLASSES = "border border-zinc-200 dark:border-zinc-700"
def self.header_cell_classes(..., bordered:, ...)
classes << BORDERED_CELL_CLASSES if bordered
end
def self.cell_classes(..., bordered:, ...)
classes << BORDERED_CELL_CLASSES if bordered
end
BORDERED_CELL_CLASSES =
"border-x border-zinc-200 dark:border-zinc-700 first:border-l-0 last:border-r-0"
Docs / Live examples present bordered: true as a single visual variant, so hosts reasonably expect an outline card, not a spreadsheet grid.
bordered: for exterior (or rename for clarity) and add cell_borders: / grid: for vertical cell rules.bordered: false | :outline | :grid (or true = outline for back-compat if that’s the majority need).bordered: :outline (or equivalent) asserts wrapper/table has border classes and cells do not include BORDERED_CELL_CLASSES.<%= rui_table(@lots, bordered: :outline, shape: :rounded) %>
<%= rui_table(@lots, bordered: :grid, shape: :rounded) %>