Workspace Switcher
Compact workspace/org switcher for app chrome.
Import
tsx
import { WorkspaceSwitcher } from "@cronus-ui/ui";
bash
npx cronus-ui add workspace-switcher
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component WorkspaceSwitcherDefault layout:inline style:workspace-switcher {
aria-label:"Switch workspace"
label "Switch workspace"
text "Cronus"
text "Northwind"
}
page "/audit/workspace-switcher/default" type:custom {
use WorkspaceSwitcherDefault
}
API Reference
Generated from the component's exported types.
WorkspaceSwitcherLabels
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | "Switch workspace" | Accessible name for the trigger. |
WorkspaceSwitcherProps
| Prop | Type | Default | Description |
|---|---|---|---|
workspaces* | readonly WorkspaceItem[] | — | — |
value | string | — | Controlled selected workspace id. Pair with `onValueChange`. |
defaultValue | string | — | Uncontrolled initial workspace id. Defaults to the first workspace. |
onValueChange | (id: string) => void | — | Called with the selected workspace id. |
labels | WorkspaceSwitcherLabels | — | Override any subset of the built-in English strings. |
className | string | — | Additional class names merged onto the root. |
ref | Ref<HTMLButtonElement> | — | Forwarded to the trigger button. |