Dashral Pro is on the wayGet 30% off at launch

Dashral

Dashboard header

A sidebar toggle and breadcrumb, ⌘K search, notifications and the account menu.

$ pnpm dlx shadcn@latest add @dashral/dashboard-header

When to use

  • The top bar of a dashboard: where you are, ⌘K search, notifications and the account menu.
  • Apps with a sidebar it can toggle; pair it with Dashboard sidebar.

When not to use

  • Marketing sites: Website header or Pill header.
  • Apps where people switch workspaces all day: Workspace header puts the switch and the section's tabs up front.

Usage

Dashboard header with your own data: every prop has the sample as its default, so pass only what you have.

example.tsx
import { DashboardHeader } from "@/components/dashral/blocks/dashboard-header"

<DashboardHeader
  onToggleSidebar={() => setSidebarOpen((open) => !open)}
  breadcrumb={[{ label: "Customers", href: "/customers" }, { label: customer.name }]}
  notifications={notifications}
  onRead={(id) => api.notifications.read(id)}
  onReadAll={() => api.notifications.readAll()}
  user={{ name: session.name, email: session.email, src: session.avatar }}
  onAccount={(action) => action === "sign-out" && signOut()}
/>

API reference

DashboardHeader

A dashboard's top bar: the sidebar toggle and where you are on the left; search (also on ⌘K / Ctrl+K), notifications and the account menu on the right. The trail, notifications, search and account come from props, with the sample by default; reading a notification calls onRead (all of them, onReadAll).

PropTypeDefault
onToggleSidebar() => void—
breadcrumb{ label: string; href?: string }[]

Where you are; the last one is this page (on phones, the only one shown).

sample
notificationsHeaderNotification[]

Re-read when you pass a new list.

sample
onRead(id: HeaderNotification["id"]) => void—
onReadAll() => void—
searchHeaderSearchGroup[]

The groups in the ⌘K search.

sample
user{ name: string; email: string; src?: string }sample
onAccount(action: HeaderAccountAction) => void—

type HeaderNotification

One line in the bell's list: who did what, and when (as you'd write it: "2m ago"). Unread unless read.

PropTypeDefault
idstring | number—
whostring—
whatstring—
whenstring—
srcstring—
readboolean—

type HeaderSearchItem

A row in the ⌘K search; it closes the search when picked.

PropTypeDefault
labelstring—
iconReact.ReactNode—
shortcutstring—
onSelect() => void—

type HeaderSearchGroup

PropTypeDefault
headingstring—
itemsHeaderSearchItem[]—

type HeaderAccountAction

What the account menu asks for.

= "profile" | "billing" | "settings" | "sign-out"