App Header
Two-row app header: breadcrumbs, ⌘K search trigger and notification dot on top; view tabs with Filter / Display actions below. Includes a working command palette (Radix Dialog) with grouped, filterable, keyboard-navigable commands.
minimal/layout/app-headerSource
"use client";
import { useEffect, useMemo, useState, type ReactNode } from "react";
import { Dialog } from "radix-ui";
import { Bell, ChevronRight, CornerDownLeft, ListFilter, Search, SlidersHorizontal } from "lucide-react";
import { cn } from "@/lib/utils";
export interface AppHeaderCommand {
id: string;
label: string;
group: string;
hint?: string;
onSelect?: () => void;
}
export interface AppHeaderProps {
breadcrumbs?: { label: string; href?: string }[];
views?: { label: string; href: string }[];
activeView?: string;
commands?: AppHeaderCommand[];
notifications?: number;
actions?: ReactNode;
/** DA scope for the portalled command palette. */
da?: string;
className?: string;
}
const DEFAULT_COMMANDS: AppHeaderCommand[] = [
{ id: "new", label: "Declare incident", group: "Actions", hint: "C" },
{ id: "page", label: "Page on-call engineer", group: "Actions", hint: "P" },
{ id: "status", label: "Update status page", group: "Actions" },
{ id: "inc-2481", label: "INC-2481 · Elevated 5xx on checkout-api", group: "Incidents" },
{ id: "inc-2480", label: "INC-2480 · Webhook delivery delays", group: "Incidents" },
{ id: "go-oncall", label: "Go to On-call", group: "Navigation", hint: "G O" },
{ id: "go-settings", label: "Go to Settings", group: "Navigation", hint: "G S" },
];
export function AppHeader({
breadcrumbs = [{ label: "Payments", href: "#team" }, { label: "Incidents" }],
views = [
{ label: "Active", href: "#active" },
{ label: "Resolved", href: "#resolved" },
{ label: "All", href: "#all" },
],
activeView = "#active",
commands = DEFAULT_COMMANDS,
notifications = 3,
actions,
da = "minimal",
className,
}: AppHeaderProps) {
const [open, setOpen] = useState(false);
const [query, setQuery] = useState("");
const [index, setIndex] = useState(0);
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
e.preventDefault();
setOpen((o) => !o);
}
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, []);
const results = useMemo(() => {
const q = query.trim().toLowerCase();
return q ? commands.filter((c) => c.label.toLowerCase().includes(q)) : commands;
}, [commands, query]);
const select = (cmd: AppHeaderCommand | undefined) => {
if (!cmd) return;
cmd.onSelect?.();
setOpen(false);
};
const onOpenChange = (o: boolean) => {
setOpen(o);
if (o) {
setQuery("");
setIndex(0);
}
};
return (
<header className={cn("border-b border-da-border bg-da-bg text-da-fg", className)}>
<div className="flex h-12 items-center gap-3 px-4">
<nav aria-label="Breadcrumb" className="min-w-0">
<ol className="flex items-center gap-1 text-[13px]">
{breadcrumbs.map((c, i) => {
const last = i === breadcrumbs.length - 1;
return (
<li key={`${c.label}-${i}`} className="flex min-w-0 items-center gap-1">
{c.href && !last ? (
<a href={c.href} className="da-focus da-transition truncate rounded-da-sm px-1 text-da-muted-fg hover:text-da-fg">
{c.label}
</a>
) : (
<span aria-current={last ? "page" : undefined} className="truncate px-1 font-medium">
{c.label}
</span>
)}
{!last && <ChevronRight aria-hidden className="size-3.5 shrink-0 text-da-muted-fg" />}
</li>
);
})}
</ol>
</nav>
<div className="ml-auto flex items-center gap-1.5">
<Dialog.Root open={open} onOpenChange={onOpenChange}>
<Dialog.Trigger className="da-focus da-transition da-stroke hidden h-7 w-56 items-center gap-2 rounded-da-md whitespace-nowrap bg-da-surface px-2 text-[13px] text-da-muted-fg hover:[--da-border:var(--da-border-strong)] sm:flex">
<Search aria-hidden className="size-3.5" />
<span className="truncate">Search or jump to…</span>
<kbd className="ml-auto font-da-mono text-[10px]">⌘K</kbd>
</Dialog.Trigger>
<Dialog.Trigger aria-label="Search" className="da-focus grid size-7 place-items-center rounded-da-sm text-da-muted-fg hover:bg-da-fg/5 sm:hidden">
<Search aria-hidden className="size-4" />
</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Overlay data-da={da} className="fixed inset-0 z-50 bg-da-overlay transition-opacity duration-(--da-duration) starting:opacity-0" />
<Dialog.Content
data-da={da}
className="da-stroke fixed top-[18vh] left-1/2 z-50 w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 overflow-hidden rounded-da-lg bg-da-surface text-da-surface-fg shadow-da-lg transition-[opacity,scale] duration-(--da-duration) ease-da starting:scale-[0.98] starting:opacity-0 motion-reduce:transition-none"
>
<Dialog.Title className="sr-only">Command palette</Dialog.Title>
<Dialog.Description className="sr-only">Type to filter commands, use arrow keys to move and Enter to run.</Dialog.Description>
<div className="flex items-center gap-2 border-b border-da-border px-4">
<Search aria-hidden className="size-4 text-da-muted-fg" />
<input
autoFocus
role="combobox"
aria-expanded
aria-controls="app-header-commands"
aria-activedescendant={results[index] ? `cmd-${results[index].id}` : undefined}
value={query}
onChange={(e) => {
setQuery(e.target.value);
setIndex(0);
}}
onKeyDown={(e) => {
if (e.key === "ArrowDown") {
e.preventDefault();
setIndex((i) => Math.min(i + 1, results.length - 1));
} else if (e.key === "ArrowUp") {
e.preventDefault();
setIndex((i) => Math.max(i - 1, 0));
} else if (e.key === "Enter") {
e.preventDefault();
select(results[index]);
}
}}
placeholder="Type a command or search…"
className="h-12 flex-1 bg-transparent text-sm outline-none placeholder:text-da-muted-fg"
/>
</div>
<ul id="app-header-commands" role="listbox" aria-label="Commands" className="max-h-80 overflow-y-auto p-1.5">
{results.length === 0 && <li className="px-3 py-8 text-center text-sm text-da-muted-fg">No results for “{query}”</li>}
{results.map((c, i) => {
const showGroup = i === 0 || results[i - 1]?.group !== c.group;
return (
<li key={c.id} role="presentation">
{showGroup && <p className="px-2.5 pt-2 pb-1 text-[11px] font-medium text-da-muted-fg">{c.group}</p>}
<div
id={`cmd-${c.id}`}
role="option"
aria-selected={i === index}
onMouseMove={() => setIndex(i)}
onClick={() => select(c)}
className={cn("flex h-9 cursor-pointer items-center gap-2 rounded-da-sm px-2.5 text-[13px]", i === index && "bg-da-fg/[0.06]")}
>
<span className="flex-1 truncate">{c.label}</span>
{c.hint && <kbd className="font-da-mono text-[10px] text-da-muted-fg">{c.hint}</kbd>}
{i === index && <CornerDownLeft aria-hidden className="size-3.5 text-da-muted-fg" />}
</div>
</li>
);
})}
</ul>
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
{actions}
<a href="#notifications" aria-label={`Notifications, ${notifications} unread`} className="da-focus da-transition relative grid size-7 place-items-center rounded-da-sm text-da-muted-fg hover:bg-da-fg/5 hover:text-da-fg">
<Bell aria-hidden className="size-4" />
{notifications > 0 && <span aria-hidden className="absolute top-1 right-1 size-1.5 rounded-full bg-da-primary ring-2 ring-da-bg" />}
</a>
</div>
</div>
<div className="flex h-11 items-center gap-2 border-t border-da-border px-4">
<nav aria-label="Views">
<ul className="flex items-center gap-1">
{views.map((v) => {
const active = v.href === activeView;
return (
<li key={v.href}>
<a
href={v.href}
aria-current={active ? "page" : undefined}
className={cn(
"da-focus da-transition flex h-7 items-center rounded-da-sm px-2.5 text-[13px]",
active ? "da-stroke bg-da-surface font-medium text-da-fg shadow-da-sm" : "text-da-muted-fg hover:text-da-fg",
)}
>
{v.label}
</a>
</li>
);
})}
</ul>
</nav>
<div className="ml-auto flex items-center gap-1">
<button type="button" className="da-focus da-transition flex h-7 items-center gap-1.5 rounded-da-sm px-2 text-[13px] text-da-muted-fg hover:bg-da-fg/5 hover:text-da-fg">
<ListFilter aria-hidden className="size-3.5" />
Filter
</button>
<button type="button" className="da-focus da-transition flex h-7 items-center gap-1.5 rounded-da-sm px-2 text-[13px] text-da-muted-fg hover:bg-da-fg/5 hover:text-da-fg">
<SlidersHorizontal aria-hidden className="size-3.5" />
Display
</button>
</div>
</div>
</header>
);
}
export default AppHeader;
modules/minimal/layout/app-header/index.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| breadcrumbs | { label: string; href?: string }[] | — | Last item is the current page. |
| views | { label: string; href: string }[] | — | View tabs in the second row. |
| activeView | string | "#active" | href of the active view. |
| commands | AppHeaderCommand[] | — | { id, label, group, hint?, onSelect? }[] shown in the ⌘K palette (grouped in order). |
| notifications | number | 3 | Unread count (shows a dot when > 0). |
| actions | ReactNode | — | Extra buttons before the bell. |
| da | string | "minimal" | DA scope for the portalled palette. |
| className | string | — | Classes on the <header>. |
Other app header variants in Minimal
Header Detail
Detail-page header: breadcrumbs ending on a copyable mono id, title with status pill, a key/value meta row, action buttons and underline section tabs with counts.
Header Switcher
Vercel-style global top bar: logo then organization / project / environment switchers separated by slashes (production badge in red), with dropdown lists, help, notification dot and avatar.
Header Toolbar
List-page toolbar: title with count and New button, then a search field, removable key/value filter chips, an Add filter button and a list/board view toggle.
App header in other art directions
App Header
Two-tier app header: top bar with breadcrumbs, ⌘K search field, notification bell with counter and avatar; page band with big title, meta line, primary action and folder-style tabs.
Header Compact
Dense 56px app header built from ruled cells: title with count chip, view tabs (yellow active cell), filter search, ink 'New' cell, and an optional strip of active filter chips.
Header Editor
Document/editor header: back cell, version chip, inline-editable uppercase title, save-status chip (saved/saving/unsaved), Preview cell and a yellow Publish cell; actions wrap to a full-width bar on mobile.
Header Stats
Dashboard welcome header: yellow band with eyebrow, big greeting, status sentence and two pressable actions, over a ruled KPI strip (2×2 on mobile, 4 across on desktop) with green delta chips.
App Header
Floating frosted pill top bar (search with ⌘K hint, gradient notification counter, avatar menu button) above a page heading with a frosted segmented tab switcher and a gradient primary action.
Header Document
Sticky glass editor header: breadcrumbs, inline-editable document title, saved/editing indicator, live viewers with green presence rings, gradient Share button and more menu.
Header Greeting
Dashboard header with a time-of-day greeting and day summary, notification bell with gradient counter, a large glass “Ask Halo” search bar with gradient submit and quick-action chips.
Header Meeting
In-call glass header pill: pulsing REC timer, meeting title, “Halo is taking notes” gradient chip, participant avatars, grid/speaker layout toggle, translate toggle and a red Leave button.
App Header
Path-style app header: slash-separated breadcrumb “Nord Studio / Projects / Oslo Opera” (last segment ink), live status with signal dot and last-edit time in mono, outline “Preview” and ink “Publish”.
Header Editor
Editor top bar in three zones: back arrow + editable page title, a centered square device switcher (desktop/tablet/mobile, radio semantics), and undo/redo text actions + save state + ink Publish.
Header Tabs
Settings-style header: title + domain subtitle, then a row of text tabs with an ink underline on the active one sitting on the hairline; scrolls horizontally on mobile.
Header Title
Big-title page header: a huge display title with a superscript mono count, then a ruled toolbar with text filters (slash separated, active underlined in signal) on the left and view options + ink action on the right.
App Header
Page header for app screens: breadcrumb trail, title + description, right-aligned secondary/primary actions and an optional row of key-value meta; white with a bottom border.
Header Global
Global top bar: logo, entity switcher (Radix dropdown), centered search with ⌘K hint, help + notifications (count) icon buttons and a user avatar menu (profile, settings, sign out).
Header Report
Report header: title with “last updated” + refresh, a toolbar with period segmented control, entity select, compare toggle and Export; wraps on mobile.
Header Tabs
Record header (e.g. a customer): avatar initials, name + status pill, subtitle, action buttons, and an underline tab bar (links with aria-current and counts) that scrolls horizontally on mobile.
App Header
Friendly app header: time-of-day serif greeting with the user’s name in italic sage, a calm subtitle, a rounded search field, bell with soft dot and an initials avatar.
Header Period
Report header: serif title with an italic period word that updates, a pill period switcher (radio semantics) and a soft export button; a wavy divider underneath.
Header Progress
Page header with a target ring: soft breadcrumb, serif title and description, and on the right a circular progress ring (sage stroke on sand) with the percentage and target label.
Header Tabs
Section header with pill tabs: serif title and a sage action on one row, then a sand track of pill links (active one cream with shadow, counts in small circles) that scrolls on mobile.
App Header
Friendly top header: “Good morning, Ana 👋” with a day summary; search pill, bell with red badge, periwinkle “New” button and emoji avatar on the right.
Header Board
Board page header: emoji tile, title and description, member emoji avatars, ink Share pill, then a pill view switcher (Board, List, Week) and a filter button.
Header Search
Search-first header: wide rounded search field with clear button, and emoji filter chips (Assigned to me, Due soon, Overdue, Done) that toggle to ink below.
Header Week
Week-planner header: round prev/next arrows around the week range (announced), a lavender “Today” pill and a mint progress pill with emoji and mini bar.