Skip to content
Components

Menu

Actions in a floating panel.

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

<%= lc_menu id: "my-component-menu", label: "Project actions" do %>
  <%= lc_menu_option "Edit project", href: "/components/input" %>
  <%= lc_menu_option "Duplicate project" %>
  <%= lc_menu_option "Archive project", tone: :destructive %>
<% end %>
<%= lc_menu id: "example-0-menu", label: "Project actions" do %>
  <%= lc_menu_option "Edit project", href: "/components/input" %>
  <%= lc_menu_option "Duplicate project" %>
  <%= lc_menu_option "Archive project", tone: :destructive %>
<% end %>
<div class="flex flex-wrap items-center gap-content">
  <%= lc_menu id: "example-1-row-menu", label: "Actions for Alex", trigger: :icon do %>
    <%= lc_menu_option "Rename", icon: "pencil" %>
    <%= lc_menu_option "Move up", icon: "arrow-up", hint: "Second in the list" %>
    <%= lc_menu_option "Copy link" %>
    <%= lc_menu_option "Pinned", icon: "star", checkbox: true %>
    <%= lc_menu_option "Remove", icon: "trash", href: "/components/menu.html", method: :delete, tone: :destructive %>
  <% end %>
  <%= lc_menu id: "example-1-currency-menu", label: "Currency", align: :start do |menu| %>
    <% menu.trigger { |attrs| lc_select_trigger "Euro", **attrs } %>
    <%= lc_menu_group "Suggested", id: "example-1-suggested" do %>
      <%= lc_menu_option "Euro", hint: "EUR", leading: tag.span("€"), checked: true %>
      <%= lc_menu_option "Japanese yen", hint: "JPY", leading: tag.span("¥"), checked: false %>
    <% end %>
    <%= lc_menu_group "Other", id: "example-1-other" do %>
      <%= lc_menu_option "US dollar", hint: "USD", leading: tag.span("$"), checked: false %>
    <% end %>
  <% 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_menu

lc_menu(id:, label: lc_t("lostcoords.ui.menu.label"), 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.menu.label")Accessible name, visible where applicable
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

lc_menu_option

lc_menu_option(label = nil, href: nil, tone: :default, icon: nil, leading: nil, hint: nil, checked: nil, checkbox: false, method: nil, params: {}, form_attributes: {}, **attributes, &block)
InputDefaultValues
labelnilAccessible name, visible where applicable
hrefnil—
tone:default:default · :destructive
iconnilHeroicon name; spacing is handled automatically
leadingnil—
hintnil—
checkednil—
checkboxfalsetrue · false
methodnil—
params{}—
form_attributes{}—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_menu_group

lc_menu_group(label, id:, **attributes, &block)
InputDefaultValues
labelRequiredAccessible name, visible where applicable
idRequired—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

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