Badge
Labels, counts and status.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_badge "Draft" %>
<%= lc_badge "Published", tone: :primary %>
<%= lc_badge "Complete", tone: :success %>
<%= lc_badge "Needs attention", tone: :warning %>
<%= lc_badge "Failed", tone: :destructive %>
Examples
Tones
Draft
Published
Complete
Needs attention
Failed
<%= lc_badge "Draft" %>
<%= lc_badge "Published", tone: :primary %>
<%= lc_badge "Complete", tone: :success %>
<%= lc_badge "Needs attention", tone: :warning %>
<%= lc_badge "Failed", tone: :destructive %>
Pill status
On track
Pending
3 errors
<%= lc_badge "On track", tone: :primary, shape: :pill %>
<%= lc_badge "Pending", shape: :pill %>
<%= lc_badge "3 errors", tone: :destructive, shape: :pill %>
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_badge
lc_badge(content = nil, tone: :neutral, shape: :rounded, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| content | nil | — |
| tone | :neutral | :neutral · :success · :warning · :destructive · :primary |
| shape | :rounded | :rounded · :pill |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
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.