Skip to content
Components

Tab bar

Links to the views of a page as a row of underlined tabs, with counts.

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

<%= lc_tab_bar label: "Inbox", fill: true, class: "w-full" do |bar| %>
  <%= bar.link "All", "#all", current: true, count: 128 %>
  <%= bar.link "Mentions", "#mentions", count: 12 %>
  <%= bar.link "Replies", "#replies", count: 4 %>
  <%= bar.link "Archived", "#archived" %>
<% end %>
<%= lc_tab_bar label: "Inbox", fill: true, class: "w-full" do |bar| %>
  <%= bar.link "All", "#all", current: true, count: 128 %>
  <%= bar.link "Mentions", "#mentions", count: 12 %>
  <%= bar.link "Replies", "#replies", count: 4 %>
  <%= bar.link "Archived", "#archived" %>
<% end %>
<%= lc_tab_bar label: "Timeline filter", class: "w-full max-w-sm" do |bar| %>
  <%= bar.link "Everything", "#everything", count: 86 %>
  <%= bar.link "Replies", "#replies", current: true, count: 31 %>
  <%= bar.link "Messages", "#messages", count: 18 %>
  <%= bar.link "Likes", "#likes", count: 25 %>
  <%= bar.link "Bookmarks", "#bookmarks", count: 7 %>
  <%= bar.link "Mentions", "#mentions", count: 5 %>
<% 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_tab_bar

lc_tab_bar(label:, fill: false, **attributes, &block)
InputDefaultValues
labelRequiredAccessible name, visible where applicable
fillfalsetrue · false
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

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

InputDefaultValues
labelRequiredAccessible name, visible where applicable
urlRequired—
currentfalsetrue · false
countnil—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults

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