Components
Toggle
Pressed controls, filter links and radio choices.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_inline role: "group", aria: { label: "Topics" } do %>
<%= lc_toggle "Design", active: true %>
<%= lc_toggle "Writing" %>
<%= lc_toggle "Research" %>
<% end %>
Examples
Filters
<%= lc_inline role: "group", aria: { label: "Topics" } do %>
<%= lc_toggle "Design", active: true %>
<%= lc_toggle "Writing" %>
<%= lc_toggle "Research" %>
<% end %>
Navigation
<%= lc_inline do %>
<%= lc_toggle "All projects", href: "/components/toggle.html", active: true, size: :sm %>
<%= lc_toggle "Archived", href: "/components/badge.html", size: :sm %>
<% end %>
Disabled and ghost
<%= lc_toggle "Unavailable", disabled: true %>
<%= lc_toggle "Add filter", ghost: true %>
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_toggle
lc_toggle(label = nil, active: false, ghost: false, size: :md, href: nil, name: nil, value: nil, input: {}, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| label | nil | Accessible name, visible where applicable |
| active | false | true · false |
| ghost | false | true · false |
| size | :md | :sm · :md · :lg |
| href | nil | — |
| name | nil | — |
| value | nil | — |
| input | {} | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
The examples also use 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.