Header

Description

Use a page header to quickly for consistent page intro with breadcrumbs, actions, headline & icon.

PRO
This component is part of our professional component suite. See the installation instructions below for more on how to use it.

Examples

Default

<%= render Railsboot::HeaderComponent.new do |header| %>
  <% header.with_heading.with_content("This is the headline") %>
<% end %>
<div class="card">
  <div class="card-body">    
    <div class="d-flex justify-content-between align-items-center">
      <h2 class="mb-0">
        This is the headline
      </h2>
    </div>
  </div>
</div>

With breadcrumbs

<%= render Railsboot::HeaderComponent.new do |header| %>
  <% header.with_heading.with_content("This is the headline") %>
  <% header.with_breadcrumb.with_items([{text: "Start", href: "#"}, {text: "Some breadcrumb", active: true}]) %>
<% end %>
<div class="card">
  <div class="card-body">      <nav class="mt-0 mb-1 fw-light" aria-label="breadcrumb">
      <ol class="breadcrumb">
        <li class="breadcrumb-item">
          <a href="#">Start</a>
        </li>
        <li class="breadcrumb-item active" aria-current="page">
          Some breadcrumb
        </li>
      </ol>
    </nav>
    <div class="d-flex justify-content-between align-items-center">
      <h2 class="mb-0">
        This is the headline
      </h2>
    </div>
  </div>
</div>

With actions

<%= render Railsboot::HeaderComponent.new do |header| %>
  <% header.with_heading.with_content("This is the headline") %>
  <%= header.with_actions do %>
    <%= render Railsboot::Button::LinkComponent.new(text: "Link", href: "#") %>
  <% end %>
<% end %>
<div class="card">
  <div class="card-body">    
    <div class="d-flex justify-content-between align-items-center">
      <h2 class="mb-0">
        This is the headline
      </h2>
      <div>
        <a class="btn btn-primary" href="#">
          Link
        </a>
      </div>
    </div>
  </div>
</div>

Full

<%= render Railsboot::HeaderComponent.new do |header| %>
  <% header.with_heading.with_content("This is the headline") %>
  <% header.with_breadcrumb.with_items([{text: "Start", href: "#"}, {text: "Some breadcrumb", active: true}]) %>
  <% header.with_actions do %>
    <%= render Railsboot::Button::LinkComponent.new(text: "Link 1", href: "#") %>
    <%= render Railsboot::Button::LinkComponent.new(text: "Link 2", href: "#") %>
  <% end %>
<% end %>
<div class="card">
  <div class="card-body">      <nav class="mt-0 mb-1 fw-light" aria-label="breadcrumb">
      <ol class="breadcrumb">
        <li class="breadcrumb-item">
          <a href="#">Start</a>
        </li>
        <li class="breadcrumb-item active" aria-current="page">
          Some breadcrumb
        </li>
      </ol>
    </nav>
    <div class="d-flex justify-content-between align-items-center">
      <h2 class="mb-0">
        This is the headline
      </h2>
      <div>
        <a class="btn btn-primary" href="#">
          Link 1
        </a>
        <a class="btn btn-primary" href="#">
          Link 2
        </a>
      </div>
    </div>
  </div>
</div>

Installation

Simply download this component with all its related files and assets. Unpackage the downloaded ZIP-file, copy all relevant files into your app and adapt the things you need. The ZIP-folder contains:

  • A parent component class (app/components/railsboot/component.rb) of which all components inherit from.
  • A base component class (app/components/railsboot/base_component.rb) which is used for rendering internally.
  • The desired component itself (app/components/railsboot/header_component.rb).
  • A view template (app/components/railsboot/header_component.html.erb) for the component unless it's rendered inline.
  • Any other dependent components such as Slots (just if the component needs those)
  • Any dependent assets (JS-Files, CSS-Files) (just if the component needs those)
  • A test file for the components (test/components/railsboot/header_component_test.rb) including potential slot or dependency tests.

For more information please refer to the installation section.

Download

Download the component and its related files (e.g. templates, assets, slots etc.), unpackage the zip file and adapt the things you need.

Get access You need to purchase a professional license to download this component.