Popover
Content anchored to a trigger.
Usage
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 %>
Examples
Anchored content
<%= 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 %>
Opened from a row
<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>
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_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)
| Input | Default | Values |
|---|---|---|
| id | Required | — |
| label | lc_t("lostcoords.ui.popover.trigger") | Accessible name, visible where applicable |
| title | nil | — |
| 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 |
| 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.