Skip to content
Components

Card

Surfaces for related content.

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

<%= lc_card class: "w-full" do |card| %>
  <%= card.header title: "Project notes", description: "Keep related content together." do %>
    <%= lc_button "Edit", variant: :secondary, size: :sm %>
  <% end %>
  <%= card.content do %>
    <%= lc_text "Notes, links and files for the launch." %>
  <% end %>
  <%= card.footer do %>
    <%= lc_button "Archive", variant: :ghost %>
    <%= lc_button "Share" %>
  <% end %>
<% end %>

Project notes

Keep related content together.

Notes, links and files for the launch.

<%= lc_card class: "w-full" do |card| %>
  <%= card.header title: "Project notes", description: "Keep related content together." do %>
    <%= lc_button "Edit", variant: :secondary, size: :sm %>
  <% end %>
  <%= card.content do %>
    <%= lc_text "Notes, links and files for the launch." %>
  <% end %>
  <%= card.footer do %>
    <%= lc_button "Archive", variant: :ghost %>
    <%= lc_button "Share" %>
  <% end %>
<% end %>

Compact card

Padding and gaps tighten together.

A compact summary.

<%= lc_card padding: :sm, class: "w-full" do |card| %>
  <%= card.header title: "Compact card", description: "Padding and gaps tighten together." %>
  <%= lc_text "A compact summary.", size: :small %>
<% end %>
<%= lc_card href: "/components/card.html", class: "w-full" do |card| %>
  <%= card.header title: "Design system", description: "Open the project." %>
<% end %>

Welcome

Padding and the gaps between parts both follow --lc-inset.

<%= lc_card class: "w-full [--lc-inset:var(--spacing-section)]" do |card| %>
  <%= card.header title: "Welcome", description: "Padding and the gaps between parts both follow --lc-inset." %>
  <%= card.footer do %>
    <%= lc_button "Get started" %>
  <% end %>
<% end %>
  • Design system

    Active

  • Marketing site

    Draft

<%= lc_card padding: :none, class: "w-full" do %>
  <ul class="m-0 list-none divide-y divide-border p-0">
    <% [ [ "Design system", "Active" ], [ "Marketing site", "Draft" ] ].each do |name, status| %>
      <li class="flex items-center justify-between gap-content p-inset">
        <%= lc_text name %>
        <%= lc_text status, size: :small, tone: :muted %>
      </li>
    <% end %>
  </ul>
<% end %>

Project settings

<%= lc_card class: "@container w-full" do |card| %>
  <%= card.header title: "Project settings" %>
  <%= card.content do %>
    <%= lc_field label: "Project name", id: "example-5-name" do |field| %>
      <%= lc_input name: "project[name]", value: "Design system", **field %>
    <% end %>
  <% end %>
  <%= card.footer do %>
    <%= lc_button "Save changes" %>
  <% end %>
<% end %>
<%= lc_card class: "w-full" do |card| %>
  <%= card.content do %>
    <%= lc_alert "Choose a unique project name.", tone: :destructive %>
    <%= lc_field label: "Project name", id: "example-6-name", error: "This name is already taken." do |field| %>
      <%= lc_input name: "project[name]", value: "Design system", **field %>
    <% end %>
  <% end %>
<% end %>

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_card

lc_card(href: nil, interactive: false, padding: :md, as: :div, **attributes, &block)
InputDefaultValues
hrefnil—
interactivefalsetrue · false
padding:md:none · :md · :sm
as:div—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_card yields a builder, card, with these parts. Each part carries data-slot and merges class: and native attributes.

card.header

card.header(title: nil, description: nil, level: 3, **attributes, &actions)
InputDefaultValues
titlenil—
descriptionnil—
level3—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
actionsCaptured blockCaptured Rails ERB content

card.title

card.title(content = nil, level: 3, **attributes, &block)
InputDefaultValues
contentnil—
level3—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

card.description

card.description(content = nil, **attributes, &block)
InputDefaultValues
contentnil—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

card.content

card.content(**attributes, &block)
InputDefaultValues
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content
InputDefaultValues
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

The examples also use lc_button, lc_text, lc_field, lc_input, and lc_alert. 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