Button
Actions, links and native Rails forms.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_button "Create project" %>
Examples
Default
<%= lc_button "Create project" %>
Variants
<%= lc_button "Primary" %>
<%= lc_button "Secondary", variant: :secondary %>
<%= lc_button "Outline", variant: :outline %>
<%= lc_button "Ghost", variant: :ghost %>
<%= lc_button "Glass", variant: :glass %>
<%= lc_button "Delete", variant: :destructive %>
Destructive tone
<%= lc_button "Revoke", variant: :ghost, tone: :destructive %>
<%= lc_button "Sign out", variant: :outline, tone: :destructive %>
<%= lc_button "Remove member", variant: :secondary, tone: :destructive %>
<%= lc_button "Delete group", tone: :destructive %>
Glass over content
Use glass for controls floating over content. Its translucency is subtle on a flat background.
<div class="grid w-full gap-4">
<p class="text-sm text-muted-foreground">Use glass for controls floating over content. Its translucency is subtle on a flat background.</p>
<div class="relative isolate h-64 overflow-hidden rounded-3xl bg-linear-to-br from-success/40 via-warning/40 to-primary/30">
<div class="absolute inset-0 grid grid-cols-3 gap-4 p-6" aria-hidden="true">
<div class="rounded-3xl bg-background/40"></div>
<div class="translate-y-12 rounded-full bg-success/40"></div>
<div class="-translate-y-8 rounded-3xl bg-warning/50"></div>
</div>
<div class="absolute inset-x-6 bottom-6 flex flex-wrap justify-center gap-3">
<%= lc_button "Save", variant: :glass, icon: "bookmark" %>
<%= lc_button "Share", variant: :glass, icon: "arrow-up-tray" %>
</div>
</div>
</div>
Sizes
<%= lc_button "Small", size: :sm %>
<%= lc_button "Default" %>
<%= lc_button "Large", size: :lg %>
With an icon
<%= lc_button "Create project", icon: "plus" %>
<%= lc_button "Continue", icon: "arrow-right", icon_position: :end, variant: :secondary %>
Custom icons and content
For custom SVGs and spinners, use data-icon="inline-start" or data-icon="inline-end". The button reduces padding on that edge for optical balance. The icon: option sets this automatically.
<%= lc_button variant: :secondary do %>
<%= lc_icon "arrow-down-tray", options: {
"aria-hidden": true,
"data-icon": "inline-start"
} %>
Download report
<% end %>
<%= lc_button disabled: true, aria: { busy: true } do %>
<%= lc_spinner size: :sm, label: nil,
data: { icon: "inline-start" } %>
Loading report…
<% end %>
Loading
<%= lc_button disabled: true, aria: { busy: true } do %>
<%= lc_spinner size: :sm, label: nil, data: { icon: "inline-start" } %>
Saving…
<% end %>
Disabled
<%= lc_button "Unavailable", disabled: true %>
As a link
<%= lc_button_link_to "Browse components", "/components/button.html", variant: :secondary %>
HTTP actions
<%= lc_button_to "Archive project", "/projects/42", method: :delete, variant: :destructive, form: { data: { turbo_confirm: "Archive this project?" } } %>
Icon buttons
<%= lc_icon_button "Add project", icon: "plus" %>
<%= lc_icon_button "Settings", icon: "cog-6-tooth", shape: :square %>
<%= lc_icon_button "Search", icon: "magnifying-glass", size: :sm %>
<%= lc_icon_button "Close", icon: "x-mark", size: :lg %>
<%= lc_icon_button_link_to "Back to buttons", "/components/button.html", icon: "chevron-left", shape: :square %>
<%= lc_icon_button "Account", size: :lg do %><span class="<%= lc_avatar_class %>">AL</span><% end %>
<%= lc_icon_button_to "Reload buttons", "/components/button.html", icon: "arrow-path", method: :get %>
<%= lc_icon_button "Edit", icon: "pencil", variant: :secondary %>
<%= lc_icon_button "Delete file", icon: "trash", variant: :outline, tone: :destructive %>
Select trigger
<%= lc_menu id: "example-12-menu", label: "Member", align: :start do |menu| %>
<% menu.trigger(class: "min-w-44") { |attrs| lc_select_trigger "All members", **attrs } %>
<%= lc_menu_option "All members", checked: true %>
<%= lc_menu_option "Alex", checked: false %>
<%= lc_menu_option "Sam", checked: false %>
<% end %>
Split button
<%= lc_split_button "Add expense", id: "example-13-menu", icon: "plus", menu_label: "More ways to add" do %>
<%= lc_menu_option "Import a CSV", icon: "arrow-down-tray" %>
<%= lc_menu_option "Scan a receipt", icon: "camera" %>
<% end %>
Split button variants and sizes
<% [ [ :secondary, :sm ], [ :outline, :md ], [ :ghost, :lg ] ].each do |variant, size| %>
<%= lc_split_button "Export", id: "example-14-#{variant}", variant: variant, size: size, menu_label: "Export options" do %>
<%= lc_menu_option "Export as CSV" %>
<%= lc_menu_option "Export as PDF" %>
<% end %>
<% end %>
Expanded swap and decorative span
<%= lc_inline do %>
<%= lc_button "New entry", icon: "plus", expanded_icon: "x-mark", size: :sm, aria: { expanded: false } %>
<%= lc_button "New entry", icon: "plus", expanded_icon: "x-mark", size: :sm, aria: { expanded: true } %>
<label class="grid place-items-center gap-related rounded-3xl bg-muted p-inset text-small text-muted-foreground">
Drop a receipt here
<%= lc_button "Browse files", as: :span, size: :sm, aria: { hidden: true } %>
<input type="file" class="sr-only">
</label>
<% end %>
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_button
| Input | Default | Values |
|---|---|---|
| content | nil | — |
| variant | :primary | :primary · :secondary · :outline · :glass · :ghost · :inset · :destructive |
| tone | :default | — |
| size | :md | :sm · :md · :lg |
| block | false | true · false |
| icon | nil | Heroicon name; spacing is handled automatically |
| icon_position | :start | :start · :end |
| as | :button | — |
| expanded_icon | nil | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content_block | Captured block | Captured Rails ERB content |
lc_button_link_to
| Input | Default | Values |
|---|---|---|
| content | nil | — |
| url | nil | — |
| variant | :primary | :primary · :secondary · :outline · :glass · :ghost · :inset · :destructive |
| tone | :default | — |
| size | :md | :sm · :md · :lg |
| block | false | true · false |
| icon | nil | Heroicon name; spacing is handled automatically |
| icon_position | :start | :start · :end |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content_block | Captured block | Captured Rails ERB content |
lc_button_to
| Input | Default | Values |
|---|---|---|
| content | nil | — |
| url | nil | — |
| variant | :primary | :primary · :secondary · :outline · :glass · :ghost · :inset · :destructive |
| tone | :default | — |
| size | :md | :sm · :md · :lg |
| block | false | true · false |
| icon | nil | Heroicon name; spacing is handled automatically |
| icon_position | :start | :start · :end |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content_block | Captured block | Captured Rails ERB content |
lc_icon_button
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| icon | nil | Heroicon name; spacing is handled automatically |
| size | :md | :sm · :md · :lg |
| icon_size | size | :sm · :md · :lg |
| shape | :circle | :square · :circle |
| variant | :ghost | :primary · :secondary · :outline · :glass · :ghost · :inset · :destructive |
| tone | :default | — |
| tooltip | nil | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content | Captured block | Captured Rails ERB content |
lc_icon_button_link_to
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| url | Required | — |
| icon | nil | Heroicon name; spacing is handled automatically |
| size | :md | — |
| icon_size | size | — |
| shape | :circle | — |
| variant | :ghost | — |
| tone | :default | — |
| tooltip | nil | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content | Captured block | Captured Rails ERB content |
lc_icon_button_to
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| url | Required | — |
| icon | nil | Heroicon name; spacing is handled automatically |
| size | :md | — |
| icon_size | size | — |
| shape | :circle | — |
| variant | :ghost | — |
| tone | :default | — |
| tooltip | nil | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content | Captured block | Captured Rails ERB content |
lc_icon
lc_icon(name, variant: :outline, options: {}, path_options: {})
| Input | Default | Values |
|---|---|---|
| name | Required | — |
| variant | :outline | — |
| options | {} | — |
| path_options | {} | — |
lc_select_trigger
lc_select_trigger(label = nil, size: :md, block: false, **attributes, &content)
| Input | Default | Values |
|---|---|---|
| label | nil | Accessible name, visible where applicable |
| size | :md | — |
| block | false | true · false |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| content | Captured block | Captured Rails ERB content |
lc_split_button
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| id | Required | — |
| href | nil | — |
| menu_label | lc_t("lostcoords.ui.menu.label") | — |
| variant | :primary | — |
| tone | :default | — |
| size | :md | — |
| icon | nil | Heroicon name; spacing is handled automatically |
| icon_position | :start | :start · :end |
| block | false | true · false |
| align | :end | — |
| action | {} | — |
| toggle | {} | — |
| menu | {} | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| items | Captured block | Captured Rails ERB content |
The examples also use lc_spinner, lc_menu, lc_menu_option, and lc_inline. 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.