Stats
Headline numbers, in a line or as tiles.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_stats do %>
<%= lc_stat "1,204", label: "replies sent", tone: :primary %>
<%= lc_stat "318", label: "replies received" %>
<%= lc_stat label: "people" do %><a href="#people" class="text-inherit hover:underline">96</a><% end %>
<%= lc_stat "42", label: "two-way", tone: :success %>
<% end %>
Examples
In a line
- replies sent
- 1,204
- replies received
- 318
- people
- 96
- two-way
- 42
<%= lc_stats do %>
<%= lc_stat "1,204", label: "replies sent", tone: :primary %>
<%= lc_stat "318", label: "replies received" %>
<%= lc_stat label: "people" do %><a href="#people" class="text-inherit hover:underline">96</a><% end %>
<%= lc_stat "42", label: "two-way", tone: :success %>
<% end %>
Tiles
<%= lc_card padding: :sm, class: "w-full max-w-sm" do %>
<%= lc_stats layout: :grid, columns: 2 do %>
<%= lc_stat 24, label: "Replies from you", tone: :primary %>
<%= lc_stat 17, label: "Replies from them" %>
<%= lc_stat 9, label: "Likes" %>
<%= lc_stat 0, label: "Bookmarks", tone: :warning %>
<% end %>
<% end %>
API reference
Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.
lc_stats
lc_stats(layout: :inline, columns: nil, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| layout | :inline | :inline · :grid |
| columns | nil | :2 · :3 · :4 |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
lc_stat
lc_stat(value = nil, label:, tone: :default, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| value | nil | — |
| label | Required | Accessible name, visible where applicable |
| tone | :default | :default · :primary · :success · :warning · :destructive |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
The examples also use lc_card. Each is documented on its own page.
Styling and extension
Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.