Skip to content
Klarhimmel UI

App sidebar, icon rail

App sidebar, icon rail previewApp sidebar, icon rail preview

Install

npx shadcn add https://ui.klarhimmel.com/r/app-sidebar-rail.json
DetailsAbout, usage, props and more

An app's side navigation as a narrow rail of icons beside every page: the product's initial on top and up to eight places whose names show in tooltips (on hover and…

Import

Import

import Block from '@/components/klarhimmel/blocks/app-sidebar-rail';
Also called
  • app/sidebar-rail
About
An app's side navigation as a narrow rail of icons beside every page: the product's initial on top and up to eight places whose names show in tooltips (on hover and keyboard focus). On a phone it folds into a menu.
Category
Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

Notes

When to use it

An app's side navigation as a narrow rail of icons: the product's initial on top and up to eight places whose names show in tooltips on hover and keyboard focus. Use app-sidebar-flat when names should always be visible.

Writing for it

- Choose icons that people know at a glance, since the name appears only on hover or focus. - Write each name short enough for a tooltip, one or two words. - Set the current page to the label of one place so it is marked.

Watch out for

A rail saves width but hides names, so a new user has to hover to learn it. On a phone it folds into a menu and the names return as text.

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 AppSidebarRail from '@/components/klarhimmel/blocks/app-sidebar-rail';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppSidebarRail props={{
          "brand": "Name the product",
          "navLabel": "Main navigation",
          "items": [
            {
              "label": "First page",
              "icon": "gauge",
              "href": "#overview"
            },
            {
              "label": "Second page",
              "icon": "book",
              "href": "#bookings"
            },
            {
              "label": "Page three",
              "icon": "users",
              "href": "#team"
            },
            {
              "label": "Fourth page",
              "icon": "settings",
              "href": "#settings"
            }
          ],
          "active": "First 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'Name the product'Text, up to 30 characters.
navLabelstring'Main navigation'Text, up to 40 characters.
items{ label, icon, href, badge }[]4 itemsList of 1 to 8. Each item: label, icon ('zap' | 'shield' | 'layers' | 'globe' | 'sparkles' | 'clock' | 'code' | 'palette' | 'lock' | 'chart' | 'users' | 'mail' | 'heart' | 'rocket' | 'search' | 'settings' | 'check' | 'star' | 'book' | 'box' | 'cloud' | 'compass' | 'leaf' | 'gauge'), href, badge (optional).
activestring'First page'Text, up to 30 characters.