Dashral Pro is on the wayGet 30% off at launch

Dashral

Workspace header

A workspace switcher, the section's tabs underneath, and help, notifications and the account menu.

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

When to use

  • A header for apps with several workspaces or projects, with the section's tabs underneath.
  • Project tools and agencies' client workspaces, where switching context is part of the day.

When not to use

  • Apps with a single workspace: Dashboard header is simpler.
  • Public sites: Website header.

Usage

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

example.tsx
import { WorkspaceHeader } from "@/components/dashral/blocks/workspace-header"

<WorkspaceHeader
  workspaces={workspaces}
  workspace={workspaceId}
  onWorkspaceChange={(id) => router.push(`/w/${id}`)}
  sections={sections}
  section={section}
  onSectionChange={setSection}
  user={user}
  onAction={(action) => handleHeaderAction(action)}
/>

API reference

WorkspaceHeader

Two rows: the workspace and project switchers with help, notifications and the account menu on top, and the section's tabs underneath, with an underline that slides to the one you pick. Every part comes from props: what's picked can be controlled, and every menu item and button tells onAction.

PropTypeDefault
workspacesWorkspace[]sample
workspacestring

The workspace picked, by id (the header keeps it without it).

—
onWorkspaceChange(id: string) => void—
projectsProject[]

The projects in it; none hides the project switcher.

sample
projectstring—
onProjectChange(id: string) => void—
sectionsSection[]

The tabs underneath: links (href), or picked in place (onSectionChange); none hides the row.

sample
sectionstring—
onSectionChange(label: string) => void—
user{ name: string; email: string; src?: string }sample
notificationsnumber

Unread notifications: a dot on the bell when there are any.

2
onAction(action: HeaderAction) => void—

type Workspace

PropTypeDefault
idstring—
namestring—
planstring—
colorstring—

type Project

PropTypeDefault
idstring—
namestring—
statusstring—

type Section

PropTypeDefault
labelstring—
hrefstring—

type HeaderAction

What the account menu and the workspace and project menus can ask for.

= "create-workspace" | "workspace-settings" | "new-project" | "feedback" | "help" | "notifications" | "profile" | "billing" | "sign-out"