Subheader

A secondary navigation bar below the header with breadcrumbs, sidebar toggle, and action buttons.

Full Example#

Complete subheader setup with sidebar toggle, breadcrumbs, and action buttons.

layout.build_subheader do |subheader|
  subheader.build_sidebar_toggle_button(target: ui.layout.sidebars.first)

  subheader.build_breadcrumbs do |breadcrumbs|
    breadcrumbs.build_breadcrumb("Home", "#")
    breadcrumbs.build_breadcrumb("Settings", "#")
    breadcrumbs.build_breadcrumb("Profile")
  end

  subheader.build_button("settings", "#", title: "Settings")
  subheader.build_button("info", "#", title: "Info")
end

A button to toggle the sidebar visibility on mobile or collapsed layouts.

layout.build_subheader do |subheader|
  subheader.build_sidebar_toggle_button(target: ui.layout.sidebars.first)
end

Display navigation breadcrumbs showing the current page hierarchy.

layout.build_subheader do |subheader|
  subheader.build_breadcrumbs do |breadcrumbs|
    breadcrumbs.build_breadcrumb("Home", "#")
    breadcrumbs.build_breadcrumb("Users", "#")
    breadcrumbs.build_breadcrumb("Profile")
  end
end

Buttons#

Add action buttons to the right side of the subheader.

layout.build_subheader do |subheader|
  subheader.build_breadcrumbs do |breadcrumbs|
    breadcrumbs.build_breadcrumb("Dashboard")
  end

  subheader.build_button("settings", "#", title: "Settings")
  subheader.build_button("info", "#", title: "Info")
end

Toggle Buttons#

Add toggle buttons on the right side for panels other than the main sidebar.

layout.build_subheader do |subheader|
  subheader.build_breadcrumbs do |breadcrumbs|
    breadcrumbs.build_breadcrumb("Home")
  end

  subheader.build_toggle_button(icon: "chevron-right", title: "Toggle panel", target: ui.layout.sidebars.last)
end