Genesis
@beta

WorkspaceSwitcher

The workspace switcher. Put it in AppShell's `headerSlot`, and the `rail` and `bar` variants in `collapsedHeaderSlot` and `mobileHeaderSlot`.

packages/ui/src/components/layout/workspace-switcher.tsx

Import
Subpath export: @marktiderman/genesis-ui/layout
import { WorkspaceSwitcher } from "@marktiderman/genesis-ui/layout";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

workspaceThemeStyle

The CSS variables for a workspace's brand (`workspace.theme.accent`): `--primary`, `--primary-foreground` and `--ring` pointed at an accessible shade of the accent, as `brandThemeStyle` does for a public page. Empty without a valid accent. The switcher puts it on each workspace's picture and row; an app can put the current workspace's on its shell to brand everything inside (pass `{ mode: "dark" }` when that shell renders dark, so `--primary-text` reads on the dark background).

No declared props.

WorkspaceSwitcher

The workspace switcher. Put it in AppShell's `headerSlot`, and the `rail` and `bar` variants in `collapsedHeaderSlot` and `mobileHeaderSlot`.

PropTypeDefaultDescription
actionsreadonly WorkspaceSwitcherAction[]—Typed items at the bottom of the menu, after a separator.
badgeLabel((workspace: W, value: string | number) => string)—What a screen reader hears for a badge, in place of the bare value. Default: "3 new" for a number, the text itself otherwise.
classNamestring—
classNamesPartial<Record<WorkspaceSwitcherPart, string>>—A class for each part. `className` is the same as `classNames.root`.
currentWorkspace—The current workspace; defaults to the nearest WorkspaceScope's.
defaultOpenbooleanfalseWhether the menu starts open, uncontrolled.
emptyTextReactNodeNo workspaces foundShown when a search matches nothing. Default "No workspaces found".
footerReactNode | ((mode: "search" | "menu") => ReactNode)—The menu's last items, after `actions`. In the menu they are menu items (`DropdownMenuItem`); with search they must be plain links or buttons, since there is no menu around them. Pass a function to render each mode's own: `(mode) => mode === "menu" ? <DropdownMenuItem … /> : <a … />`.
hrefFor((workspace: W) => string)—Where each choice goes; defaults to the WorkspaceScope's, else the workspace's landing page.
kindIconsPartial<Record<keyof GenesisWorkspaceKinds, LucideIcon>>—Pictures for kinds without an image; merged over the defaults.
kindLabelsPartial<Record<keyof GenesisWorkspaceKinds, string | null>>—Headings over each kind's group; merged over the defaults. `null` hides a heading.
labelstringSwitch workspaceAccessible name of the trigger. Default "Switch workspace".
linkComponentLinkComponent({ href, children, testID, ...rest }) => ( <a href={href} data-testid={testID} {...rest}> {children} </a> )The router's link (see AppShell's `linkComponent`). Each row is this link with the menu item's or option's props merged on, so it must pass `ref`, `id`, `role`, `aria-*`, `tabIndex`, `onClick`, `onMouseMove`, `onKeyDown`, `style` and `data-*` through to its `<a>` (see `LinkComponent`).
onNavigate((href: string, workspace: W) => void)—How a keyboard jump (`shortcuts.jump`) goes to a workspace: pass the router's navigate. Without it a jump is a full page load of the link (a menu click still uses `linkComponent`), and the switcher warns in development.
onOpenChange((open: boolean) => void)—
onSelect((workspace: W) => void)—Called whenever the viewer picks a workspace, from the menu or the keyboard.
openboolean—Whether the menu is open, to control it.
orderreadonly (keyof GenesisWorkspaceKinds)[]—The order of the kinds in the menu (default personal, roll-up, tenants).
placeholderstringChoose a workspaceShown when the URL is in no workspace. Default "Choose a workspace".
renderBadge((workspace: W) => ReactNode)—Replaces a workspace's badge (default: its `badge`, as a pill). Shorthand for `slots.badge`. A custom badge owns its screen-reader text: `badgeLabel` reaches only the default one.
renderImage((workspace: W, size: "sm" | "md") => ReactNode)—Replaces the picture (a brand mark, a colored tile). Shorthand for `slots.image`.
renderItem((workspace: W, state: { current: boolean; }) => ReactNode)—Replaces a row's content in the menu (the link around it stays). Shorthand for `slots.item`.
searchboolean | "auto"falseA search box over the list, which then becomes a combobox (see the module comment). Default `false`. `"auto"` turns it on past {@link WORKSPACE_SWITCHER_SEARCH_THRESHOLD} workspaces. The highlight starts on the first match, not the current workspace (as in cmdk), so opening and pressing Enter goes to the first one.
searchPlaceholderstringFind a workspaceThe search box's placeholder and accessible name. Default "Find a workspace".
shortcutsWorkspaceSwitcherShortcuts—Keyboard shortcuts to open the menu and to jump to a workspace. Off by default.
slotPropsWorkspaceSwitcherSlotProps<W>—More props for a part, including the `trigger` button and the menu `content`.
slotsWorkspaceSwitcherSlots<W>—Replace or drop a part.
variantenumsidebar`sidebar` (default): the full row for `headerSlot`. `rail`: the picture alone, for the collapsed rail's `collapsedHeaderSlot`. `bar`: the name and a chevron, for the phone's top bar.
workspacesreadonly W[]—Every workspace; defaults to the nearest WorkspaceScope's.

WORKSPACE_SWITCHER_PARTS

Every part, in document order; see {@link WorkspaceSwitcherPart}.

No declared props.

WORKSPACE_SWITCHER_SCOPE

The value of every part's `data-scope`.

No declared props.

WORKSPACE_SWITCHER_SEARCH_THRESHOLD

With a switcher's `search="auto"`, past this many workspaces it opens with a search box. On the web and the phone.

No declared props.

DEFAULT_WORKSPACE_KIND_ICONS

The default picture for a kind with no image of its own; tenants show their initials.

No declared props.

Storybook
Storybook hosts the canonical visual reference with controls for every variant.