Skip to content
Components

Badge

Labels, counts and status.

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 %>
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 %>
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 %>

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)
InputDefaultValues
contentnil—
tone:neutral:neutral · :success · :warning · :destructive · :primary
shape:rounded:rounded · :pill
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured 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.

API JSON · LLM reference