Skip to content
Klarhimmel UI

Navbar, sidebar

Navbar, sidebar previewNavbar, sidebar preview

Install

npx shadcn add @klarhimmel/navbar-sidebar
DetailsAbout, usage, props and more

Navigation as a left column: the brand on top, stacked links and a button at the bottom, with an optional heading and lead in the content beside it.

Import

Import

import Block from '@/components/klarhimmel/blocks/navbar-sidebar';
Also called
  • navigation/sidebar
  • header/sidebar
About
Navigation as a left column: the brand on top, stacked links and a button at the bottom, with an optional heading and lead in the content beside it.
Category
The bar at the top of every page: brand, links, one action. New project? Set it up once: /get-started/installation.

Notes

When to use it

Pick it for an app or docs style page where the navigation is a left column beside the content: brand on top, stacked links, a button at the bottom. Turn the top bar on for a dashboard feel with search and an account chip above. For a bar across the top with links in a row use navbar-simple; for a shop header with categories use navbar-search.

Writing for it

- The brand holds 40 characters, a link label 40, and one to eight links fit the column. - The title holds 80 characters and the lead 240; both are optional and the content area draws only what is set. - The search label holds 60 and the initials 3; with the top bar on, clear the column button and use the two actions in the content instead.

Watch out for

The column is tall, so put this block first on a page and give it content of its own; below it, other sections lose the left edge. Keep link labels short, or the column grows wider than its 18rem slot and wraps.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import NavbarSidebar from '@/components/klarhimmel/blocks/navbar-sidebar';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <NavbarSidebar props={{
          "brand": "Write the business name",
          "topBar": "none",
          "links": [
            {
              "label": "Name the first page",
              "href": "#first"
            },
            {
              "label": "Name the second page",
              "href": "#second"
            },
            {
              "label": "Name the third page",
              "href": "#third"
            }
          ],
          "linksLabel": "Name the link column",
          "cta": {
            "label": "Main action",
            "href": "#start"
          },
          "eyebrow": "",
          "title": "Say what this page is about",
          "description": "Say in one or two sentences what the visitor can do on this page."
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
brandstring'Write the business name'Text, up to 40 characters.
mark{ paths, viewBox, src }-Fields: paths (optional), viewBox (optional), src (optional). Optional; empty is not rendered.
brandHrefstring-Text, up to 300 characters. Optional; empty is not rendered.
topBar'none' | 'search''none'One of 'none', 'search'. Optional; empty is not rendered.
linksLink[]3 itemsList of 1 to 8.
linksLabelstring'Name the link column'Text, up to 60 characters.
ctaLink{…}Optional; empty is not rendered.
search{ label, placeholder, href }-Fields: label (optional), placeholder (optional), href (optional). Optional; empty is not rendered.
profile{ name, initials, href }-Fields: name (optional), initials (optional), href (optional). Optional; empty is not rendered.
eyebrowstring''Text, up to 60 characters.
titlestring'Say what this page is about'Text, up to 80 characters.
descriptionstring'Say in one or two sentences what th…'Text, up to 240 characters.
primaryLink-Optional; empty is not rendered.
secondaryLink-Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.