RRUI-005 · Table · Borders

Table bordered: couples exterior and cell borders

Setting 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.

Open gem 0.54.2 2026-08-12 reported from StockLive past sale results

One boolean, two jobs. 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.

Summary

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.

Repro

<%= 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 %>
  1. Actual: Rounded wrapper gets border border-zinc-200, and each th/td gets border-x … (grid look).
  2. Expected (common host need): Outer outline only; rows still separated by the existing horizontal border-b on rows, without vertical cell rules.

Evidence (0.54.2)

Outer border on wrapper (rounded) or table (square)

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"

Same flag also paints cell vertical borders

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.

Fix in the gem

  1. Split the concerns, e.g. keep bordered: for exterior (or rename for clarity) and add cell_borders: / grid: for vertical cell rules.
  2. Or accept an enum: bordered: false | :outline | :grid (or true = outline for back-compat if that’s the majority need).
  3. Document the default clearly in USAGE + docs; add a preview for exterior-only vs full grid.
  4. Regression: bordered: :outline (or equivalent) asserts wrapper/table has border classes and cells do not include BORDERED_CELL_CLASSES.
Ideal API sketch:
<%= rui_table(@lots, bordered: :outline, shape: :rounded) %>
<%= rui_table(@lots, bordered: :grid, shape: :rounded) %>

Done when