Skip to content
Components

Tabs

Panels of related content behind one tab list, with arrow key navigation.

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

<%= lc_tabs id: "my-component-tabs", label: "Project", class: "w-full" do |tabs| %>
  <% tabs.panel "Overview" do %>
    <%= lc_text "Pages, members and recent changes." %>
  <% end %>
  <% tabs.panel "Activity" do %>
    <%= lc_text "Nothing new this week.", tone: :muted %>
  <% end %>
  <% tabs.panel "Settings" do %>
    <%= lc_switch "Public project", name: "project[public]" %>
  <% end %>
<% end %>

Pages, members and recent changes.

<%= lc_tabs id: "example-0-tabs", label: "Project", class: "w-full" do |tabs| %>
  <% tabs.panel "Overview" do %>
    <%= lc_text "Pages, members and recent changes." %>
  <% end %>
  <% tabs.panel "Activity" do %>
    <%= lc_text "Nothing new this week.", tone: :muted %>
  <% end %>
  <% tabs.panel "Settings" do %>
    <%= lc_switch "Public project", name: "project[public]" %>
  <% end %>
<% end %>

Name, photo and contact details.

<%= lc_tabs id: "example-1-settings", label: "Settings", orientation: :vertical, activation: :manual, class: "w-full" do |tabs| %>
  <% tabs.panel "Profile" do %>
    <%= lc_text "Name, photo and contact details." %>
  <% end %>
  <% tabs.panel "Notifications" do %>
    <%= lc_switch "Email me about mentions", name: "settings[mentions]" %>
  <% end %>
  <% tabs.panel "Billing" do %>
    <%= lc_text "Plan, invoices and payment method.", tone: :muted %>
  <% end %>
<% end %>

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_tabs

lc_tabs(id:, label:, selected: nil, orientation: :horizontal, activation: :automatic, list: {}, **attributes, &block)
InputDefaultValues
idRequired—
labelRequiredAccessible name, visible where applicable
selectednil—
orientation:horizontal—
activation:automatic—
list{}—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_tabs yields a builder, tabs, with these parts. Each part carries data-slot and merges class: and native attributes.

tabs.panel

tabs.panel(label, value: nil, **attributes, &block)
InputDefaultValues
labelRequiredAccessible name, visible where applicable
valuenil—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

The examples also use lc_text and lc_switch. 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