Dashral Pro is on the wayGet 30% off at launch

Dashral

Workspace sidebar

A workspace switcher, search, inbox, and Favorites and Projects that fold away; each project opens to its views.

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

When to use

  • A project tool's sidebar: a workspace switcher, search, inbox, favorites, and projects that open to their views.
  • Issue trackers, docs and planning tools organised by workspace and project.

When not to use

  • Single-team dashboards without projects: Dashboard sidebar.
  • Settings pages: Settings sidebar.

Usage

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

example.tsx
import { WorkspaceSidebar } from "@/components/dashral/blocks/workspace-sidebar"

<WorkspaceSidebar
  workspaces={workspaces}
  workspace={workspaceId}
  onWorkspaceChange={setWorkspaceId}
  projects={projects}
  favorites={favorites}
  inbox={unreadCount}
  current={page}
  onNavigate={(page) => router.push(`/${page}`)}
  onAddProject={(project) => api.projects.create(project)}
/>

API reference

WorkspaceSidebar

A project tool's sidebar, like Linear's or Notion's: the workspace switcher and new-item button, search, your inbox and issues, then Favorites and Projects that fold away. Each project opens to its views, and + adds one. Replace your workspaces, projects, views and favorites through props. Pages are ids: "inbox", "mine" and "<project>/<view>"; the one you're on is controllable, with onNavigate. + calls onAddProject, which may return the stored project.

PropTypeDefault
workspacesWorkspace[]sample
workspacestring

The workspace you're in, by id (the sidebar keeps it without it).

—
onWorkspaceChange(id: string) => void—
projectsWorkspaceProject[]sample
viewsWorkspaceView[]

The views every project opens to.

sample
favoritesWorkspaceFavorite[]sample
inboxnumber

The count beside Inbox; 0 hides it.

4
currentstring—
onNavigate(page: string) => void—
onAddProject(project: WorkspaceProject) => WorkspaceProject | void | Promise<WorkspaceProject | void>

Called with the new project; return the one you stored (its real id) or throw to take it back.

—
onAction(action: WorkspaceAction) => void—

type Workspace

A workspace in the switcher; tile is the classes of its letter tile.

PropTypeDefault
idstring—
namestring—
initialsstring—
tilestring—

type WorkspaceProject

A project; color is the class of its square.

PropTypeDefault
idstring—
namestring—
colorstring—

type WorkspaceView

PropTypeDefault
idstring—
labelstring—
iconReact.ReactNode—

type WorkspaceFavorite

A starred page: to is where it goes, a page id like the sidebar's own ("q4/board").

PropTypeDefault
tostring—
labelstring—

type WorkspaceAction

The buttons that don't navigate.

= "new-issue" | "create-workspace" | "invite" | "help"