Icon badge
A small container for a symbol.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_icon_badge icon: "folder", size: :sm %>
<%= lc_icon_badge icon: "folder" %>
<%= lc_icon_badge icon: "document-text", size: :lg %>
<%= lc_icon_badge icon: "document-text", size: :xl %>
<%= lc_icon_badge "🍜", aria: { hidden: true } %>
<%= lc_icon_badge "🍜", size: 7, shape: :plain, aria: { hidden: true } %>
Examples
Shapes and sizes
<%= lc_icon_badge icon: "folder", size: :sm %>
<%= lc_icon_badge icon: "folder" %>
<%= lc_icon_badge icon: "document-text", size: :lg %>
<%= lc_icon_badge icon: "document-text", size: :xl %>
<%= lc_icon_badge "🍜", aria: { hidden: true } %>
<%= lc_icon_badge "🍜", size: 7, shape: :plain, aria: { hidden: true } %>
Round icons and tones
<%= lc_icon_badge shape: :circle, size: :sm, icon: "sparkles", tone: :primary%>
<%= lc_icon_badge shape: :circle, icon: "user-plus", tone: :neutral, size: :lg%>
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_icon_badge
lc_icon_badge(content = nil, icon: nil, size: :md, shape: :square, tone: :neutral, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| content | nil | — |
| icon | nil | Heroicon name; spacing is handled automatically |
| size | :md | :sm · :md · :lg · :xl · :6 · :7 · :11 |
| shape | :square | :square · :circle · :plain |
| tone | :neutral | :neutral · :success · :warning · :destructive · :primary |
| 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.