Menu
Actions in a floating panel.
Usage
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 %>
Examples
Actions
<%= 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 %>
Icon trigger, hints, choices and groups
<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>
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_menu
| Input | Default | Values |
|---|---|---|
| id | Required | — |
| label | lc_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 |
| block | Captured block | Captured Rails ERB content |
lc_menu_option
| Input | Default | Values |
|---|---|---|
| label | nil | Accessible name, visible where applicable |
| href | nil | — |
| tone | :default | :default · :destructive |
| icon | nil | Heroicon name; spacing is handled automatically |
| leading | nil | — |
| hint | nil | — |
| checked | nil | — |
| checkbox | false | true · false |
| method | nil | — |
| params | {} | — |
| form_attributes | {} | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
lc_menu_group
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| id | Required | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured 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.