Skip to content
Components

Hover card

A preview of what a link points to, on hover and keyboard focus.

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

<% card = capture do %>
  <span class="flex flex-col gap-related">
    <span class="flex items-center gap-heading">
      <%= lc_avatar "AL", size: :lg %>
      <span class="flex min-w-0 flex-col">
        <span class="truncate text-label font-semibold">Ada Lovelace</span>
        <span class="truncate text-small text-muted-foreground">@ada</span>
      </span>
    </span>
    <span class="text-small">Writes about analytical engines and the poetry of numbers.</span>
    <span class="text-small text-muted-foreground"><span class="font-semibold text-foreground">1,843</span> followers · <span class="font-semibold text-foreground">12</span> replies</span>
  </span>
<% end %>
<p class="text-body">
  Notes from
  <%= lc_hovercard content: card do |preview| %>
    <%= link_to "Ada Lovelace", "#ada", class: "font-semibold text-primary hover:underline", **preview %>
  <% end %>
  on the engine's first program.
</p>

Notes from Ada Lovelace on the engine's first program.

<% card = capture do %>
  <span class="flex flex-col gap-related">
    <span class="flex items-center gap-heading">
      <%= lc_avatar "AL", size: :lg %>
      <span class="flex min-w-0 flex-col">
        <span class="truncate text-label font-semibold">Ada Lovelace</span>
        <span class="truncate text-small text-muted-foreground">@ada</span>
      </span>
    </span>
    <span class="text-small">Writes about analytical engines and the poetry of numbers.</span>
    <span class="text-small text-muted-foreground"><span class="font-semibold text-foreground">1,843</span> followers · <span class="font-semibold text-foreground">12</span> replies</span>
  </span>
<% end %>
<p class="text-body">
  Notes from
  <%= lc_hovercard content: card do |preview| %>
    <%= link_to "Ada Lovelace", "#ada", class: "font-semibold text-primary hover:underline", **preview %>
  <% end %>
  on the engine's first program.
</p>

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_hovercard

lc_hovercard(src: nil, content: nil, side: :bottom, **attributes, &block)
InputDefaultValues
srcnil—
contentnil—
side:bottom—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

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