Skip to content
Components

Popover

Content anchored to a trigger.

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

<%= lc_popover id: "my-component-popover", label: "Project details", title: "Design system" do %>
  <p class="text-sm text-muted-foreground">Updated a moment ago by Alex.</p>
<% end %>
<%= lc_popover id: "example-0-popover", label: "Project details", title: "Design system" do %>
  <p class="text-sm text-muted-foreground">Updated a moment ago by Alex.</p>
<% end %>
<div class="flex items-center gap-related min-h-control-md px-3 rounded-2xl bg-muted cursor-pointer" data-controller="lc-popover" data-action="click->lc-popover#toggleFromRow">
  <button type="button" class="font-semibold" aria-haspopup="dialog" aria-expanded="false" data-lc-popover-target="trigger" data-action="lc-popover#toggle">Alex</button>
  <span class="text-muted-foreground">Tap anywhere on the row</span>
  <%= lc_popover id: "example-1-row-popover", label: "How to pay Alex", trigger: false, align: :start do %>
    <p class="m-0">Alex takes bank transfers.</p>
  <% end %>
</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_popover

lc_popover(id:, label: lc_t("lostcoords.ui.popover.trigger"), title: nil, align: :end, side: :bottom, trigger: :button, trigger_variant: :secondary, trigger_size: :md, icon: "ellipsis-vertical", trigger_attributes: {}, wrapper_attributes: {}, **attributes, &block)
InputDefaultValues
idRequired—
labellc_t("lostcoords.ui.popover.trigger")Accessible name, visible where applicable
titlenil—
align:end:start · :end · :center
side:bottom:bottom · :top
trigger:button—
trigger_variant:secondary:primary · :secondary · :outline · :glass · :ghost · :inset · :destructive
trigger_size:md:sm · :md · :lg
icon"ellipsis-vertical"Heroicon name; spacing is handled automatically
trigger_attributes{}—
wrapper_attributes{}—
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