Layout
layered-ui-rails provides a layout system with a header, sidebar navigation, and slide-out panel. Use content_for blocks to inject content, instance variables to set metadata, and file overrides to change logos and icons.
Application layout
Your application layout should render the layered-ui-rails layout template. Place all content_for blocks above the render call - the engine layout reads them when it renders, so they must be defined first.
Edit your app/views/layouts/application.html.erb with the following content:
<!-- Optional: body modifiers -->
<% content_for :l_ui_body_class, "l-ui-body--always-show-navigation l-ui-body--hide-header" %>
<!-- Optional: sidebar navigation -->
<% content_for :l_ui_navigation_items do %>
<%= l_ui_navigation_item "Home", root_path %>
<%= l_ui_navigation_item "About", about_path %>
<% end %>
<!-- Optional: slide-out panel heading -->
<% content_for :l_ui_panel_heading do %>
<h2>Side Bar</h2>
<% end %>
<!-- Optional: slide-out panel body -->
<% content_for :l_ui_panel_body do %>
<p>This is the panel body content.</p>
<% end %>
<%= render template: "layouts/layered_ui/application" %>
Features
The layout provides these configurable features.
| Feature | Description |
|---|---|
| Logos | Header logo overrides for light and dark themes |
| Icons | Favicon, touch icon, and panel toggle button overrides |
| Colors | Accent color and full design token overrides |
| Metadata | Page title and meta description via instance variables |
| Navigation | Navigation links, off-canvas by default - use l-ui-body--always-show-navigation to pin as a sidebar on desktop |
| Header | Inline links, action slot composition, the default theme/auth/navigation helpers, and hiding the header |
| Panel | Slide-out panel with heading and body content blocks |