Skip to content
Components

Avatar

Initials or an image representing a person.

After the one-time setup, call the helper directly from ERB. No component import is needed.

<%= lc_avatar "AL", ink: true, class: "bg-accent", aria: { label: "Alex Lee" } %>
<%= lc_avatar "SK", size: :lg, ink: true, class: "bg-success-soft", aria: { label: "Sam Kim" } %>
<%= lc_avatar "JR", ink: true, class: "bg-warning-soft", aria: { label: "Jamie Rivera" } %>
<%= lc_avatar "MK", ink: true, class: "bg-destructive-soft", aria: { label: "Morgan Kim" } %>
AL SK JR MK
<%= lc_avatar "AL", ink: true, class: "bg-accent", aria: { label: "Alex Lee" } %>
<%= lc_avatar "SK", size: :lg, ink: true, class: "bg-success-soft", aria: { label: "Sam Kim" } %>
<%= lc_avatar "JR", ink: true, class: "bg-warning-soft", aria: { label: "Jamie Rivera" } %>
<%= lc_avatar "MK", ink: true, class: "bg-destructive-soft", aria: { label: "Morgan Kim" } %>
AL AL AL AL AL AL AL AL
<% [ :xs, :sm, 7, :md, 11, :lg, :xl, :xxl ].each do |size| %>
  <%= lc_avatar "AL", size: size, ink: true, class: "bg-accent", aria: { label: "Alex Lee (#{size})" } %>
<% end %>
AL SK JR
<%= lc_avatar_stack aria: { label: "Alex, Sam and Jamie" } do %>
  <%= lc_avatar "AL", ink: true, class: "bg-success-soft" %>
  <%= lc_avatar "SK", ink: true, class: "bg-warning-soft" %>
  <%= lc_avatar "JR", ink: true, class: "bg-destructive-soft" %>
<% end %>
AL
🏯
<div class="relative">
  <%= lc_avatar "AL", size: :xl %>
  <%= lc_avatar_badge "camera", label: "Change photo", as: :button %>
</div>
<div class="relative">
  <%= lc_icon_badge "🏯", size: :xl %>
  <%= lc_avatar_badge "lock-closed" %>
</div>

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_avatar

lc_avatar(content = nil, src: nil, alt: nil, size: :md, ink: false, linked: false, as: :span, **attributes, &block)
InputDefaultValues
contentnil—
srcnil—
altnil—
size:md:xs · :sm · :md · :lg · :xl · :xxl · :7 · :11
inkfalsetrue · false
linkedfalsetrue · false
as:span—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_avatar_stack

lc_avatar_stack(compact: false, size: :md, overlap: :md, row: {}, **attributes, &block)
InputDefaultValues
compactfalsetrue · false
size:md—
overlap:md—
row{}—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_avatar_badge

lc_avatar_badge(icon, label: nil, as: :span, size: nil, **attributes)
InputDefaultValues
iconRequiredHeroicon name; spacing is handled automatically
labelnilAccessible name, visible where applicable
as:span—
sizenil—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults

The examples also use lc_icon_badge. 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.

API JSON · LLM reference