Skip to content

Page header ​

A page title with breadcrumb navigation, a short description and primary actions.

Installation ​

bash
npx bootcn add page-header
bash
pnpm dlx bootcn add page-header
bash
yarn dlx bootcn add page-header
bash
bunx --bun bootcn add page-header

The CLI also installs the design tokens and these blocks and components: button. It prints the <link> and <script> tags to add to your layout.

Usage ​

Put it at the top of your page's <main>. The last breadcrumb item is the current page and is not a link.

On narrow screens the actions wrap below the title.

Accessibility ​

  • The breadcrumb is a <nav aria-label="Breadcrumb"> with an ordered list; the current page has aria-current="page".
  • The title is the page's <h1>. If your layout already has an <h1>, change it to <h2>.

Dependencies ​

  • Bootstrap 5.3+ CSS.
  • themes/tokens/tokens.css.
  • The button component.

Source ​

The exact files the CLI installs (page-header@1.0.0). View on GitHub · Report an issue

html
<header class="bootcn-page-header">
  <nav aria-label="Breadcrumb">
    <ol class="breadcrumb bootcn-page-header__breadcrumb">
      <li class="breadcrumb-item"><a href="#">Home</a></li>
      <li class="breadcrumb-item"><a href="#">Projects</a></li>
      <li class="breadcrumb-item active" aria-current="page">Website redesign</li>
    </ol>
  </nav>
  <div class="bootcn-page-header__row">
    <div class="bootcn-page-header__text">
      <h1 class="bootcn-page-header__title">Website redesign</h1>
      <p class="bootcn-page-header__description">Track tasks, files and people for this project.</p>
    </div>
    <div class="bootcn-page-header__actions">
      <button type="button" class="btn bootcn-button bootcn-button--outline">Share</button>
      <button type="button" class="btn bootcn-button bootcn-button--default">
        <svg
          class="bootcn-icon"
          width="16"
          height="16"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          aria-hidden="true"
          focusable="false"
        >
          <path d="M12 5v14M5 12h14" />
        </svg>
        New task
      </button>
    </div>
  </div>
</header>
css
.bootcn-page-header {
  padding-bottom: 1.25rem;
  border-bottom: var(--bootcn-border-width) solid var(--bootcn-border-color);
}

.bootcn-page-header__breadcrumb {
  --bs-breadcrumb-margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.bootcn-page-header__breadcrumb a {
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.bootcn-page-header__breadcrumb a:hover {
  color: var(--bs-emphasis-color);
  text-decoration: underline;
}

.bootcn-page-header__breadcrumb .active {
  color: var(--bs-emphasis-color);
}

.bootcn-page-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.bootcn-page-header__text {
  min-width: 0;
}

.bootcn-page-header__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.bootcn-page-header__description {
  margin: 0.375rem 0 0;
  color: var(--bs-secondary-color);
}

.bootcn-page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

Released under the MIT License. Not affiliated with Bootstrap or shadcn/ui.