App header
A sticky glass header with your brand, navigation and actions.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_app_header class: "static w-full p-0 sm:p-0" do |header| %>
<%= header.brand "#", label: "Studio home" do %>
<span class="grid size-8 place-items-center rounded-xl bg-foreground text-background"><%= lc_icon "square-3-stack-3d", options: { class: "size-4.5", "aria-hidden": true } %></span>
Studio
<% end %>
<%= header.nav label: "Workspace", class: "max-sm:hidden" do |nav| %>
<%= nav.link "Overview", "#", current: true %>
<%= nav.link "Projects", "#" %>
<% end %>
<%= header.actions do %>
<%= lc_icon_button "Search", icon: "magnifying-glass", size: :sm %>
<%= lc_avatar "AL", size: :sm, class: "bg-primary-soft text-primary" %>
<% end %>
<% end %>
Examples
Header
<%= lc_app_header class: "static w-full p-0 sm:p-0" do |header| %>
<%= header.brand "#", label: "Studio home" do %>
<span class="grid size-8 place-items-center rounded-xl bg-foreground text-background"><%= lc_icon "square-3-stack-3d", options: { class: "size-4.5", "aria-hidden": true } %></span>
Studio
<% end %>
<%= header.nav label: "Workspace", class: "max-sm:hidden" do |nav| %>
<%= nav.link "Overview", "#", current: true %>
<%= nav.link "Projects", "#" %>
<% end %>
<%= header.actions do %>
<%= lc_icon_button "Search", icon: "magnifying-glass", size: :sm %>
<%= lc_avatar "AL", size: :sm, class: "bg-primary-soft text-primary" %>
<% end %>
<% 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_app_header
lc_app_header(bar: {}, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| bar | {} | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
lc_app_header yields a builder, header, with these parts. Each part carries data-slot and merges class: and native attributes.
header.brand
header.brand(url = "/", label:, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| url | "/" | — |
| label | Required | Accessible name, visible where applicable |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
header.nav
| Input | Default | Values |
|---|---|---|
| label | view.send(:lc_t, "lostcoords.ui.app_header.navigation") | Accessible name, visible where applicable |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
header.actions
header.actions(**attributes, &block)
| Input | Default | Values |
|---|---|---|
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
The examples also use lc_icon, lc_icon_button, and lc_avatar. 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.