import { WorkspacePicker } from "@elabs-ai/components-ui";npm install @elabs-ai/components-tokens @elabs-ai/components-uiPaste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.
Add the brand-ui WorkspacePicker component (from @elabs-ai/components-ui) to this project. 1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`. 2. Look WorkspacePicker up before writing code: `npx -y @elabs-ai/components-cli docs WorkspacePicker` prints its real props, variants, what it pairs with and what to avoid. 3. If @elabs-ai/components-ui is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`. 4. Use it here: [the screen or file, and what it should show] 5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop. 6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.
Avoid
- Re-implementing the picker list — WorkspacePicker composes ModelPicker; a second searchable-popover list is the duplication this component exists to avoid.
- Marking the current workspace with a glyph alone — the marker is a word in the accessible name (1.4.1).
- Reading the filesystem — the component takes a workspace list as a prop and never enumerates directories itself.
- Natively disabling the path submit — an empty field uses aria-disabled plus a handler guard, so focus is never stranded.
Works with
Examples
Current Workspace Marked In Text
The current workspace is marked in the row's TEXT (a "Current" badge, not only `ModelPicker`'s check glyph) — open the popover to see it, and confirm it survives a greyscale render.
No Current Workspace
No workspace chosen yet — the trigger falls back to a designed placeholder.
Empty
Nothing to show — `ModelPicker`'s own designed empty panel (reused, not reimplemented) plus the free-text path entry, which always renders in the footer regardless of body state and is this state's one action.
Long Path
A very long, deeply nested path truncates instead of overflowing the row.
Disabled
Submit Free Text Path
The free-text path entry validates non-empty and reports the raw string — this component performs no filesystem access of any kind (D5). Also proves Enter submits the path instead of being hijacked by cmdk's own list navigation (both bind a keydown handler on the same `Command` root).
API
WorkspacePicker
| Prop | Type | Description |
|---|---|---|
workspacesrequired | Workspace[] | Recent workspaces, most-relevant first — the caller owns ordering. |
currentId | string | The currently open workspace's id. |
onSelect | (workspace: Workspace) => void | Fires with the chosen workspace; the popover closes first. |
onSubmitPath | (path: string) => void | Free-text path entry, rendered in `ModelPicker`'s `footer` slot below the list. Fires with the raw string the user typed once it validates as non-empty — this component performs no filesystem access of any kind (presentation layer, D5); resolving, normalizing or checking the path is the caller's job. |
status | ModelPickerStatus | Drives the same four-body state grid as `ModelPicker` — see `ModelPickerStatus`. Default `"ready"`, inherited from `ModelPicker`. |
disabled | boolean | |
open | boolean | Controlled popover open state — see `ModelPicker`'s controlled contract. |
onOpenChange | (open: boolean) => void |
ModelPicker
| Prop | Type | Description |
|---|---|---|
groupsrequired | readonly ModelPickerGroup[] | Grouped rows. Grouping and heading text are the caller's, never derived. |
value | string | The currently pinned row's id. |
onSelect | (item: ModelPickerItem) => void | Fires with the chosen row; the popover closes first. |
status | ModelPickerStatus | Drives the four bodies — see `modelPickerBody`. Default `"ready"`. |
triggerLabelrequired | ReactNode | Trigger text — usually the pinned row's label. |
onRetry | () => void | Retry action for the error strip and the empty panel. Omit to hide it. |
searchPlaceholder | string | Search field placeholder. |
disabled | boolean | |
contentClassName | string | Extra classes for the popover panel (default width `w-96`). |
open | boolean | Controlled popover open state. Omit for the uncontrolled default (internal `useState(false)`, unchanged). `isControlled = open !== undefined` and the mode never flips mid-life — see `component-api.md` "Controlled/uncontrolled". |
onOpenChange | (open: boolean) => void | Fires whenever the popover would open/close — a trigger click, or a row select. |
footer | ReactNode | Rendered inside the popover BELOW the list — a persistent action row that is not one of the options (a free-text entry, a "browse…" affordance). Outside `CommandList` on purpose: it must not be filtered by the search query and must not participate in cmdk's roving selection. |
Input
Button
| Prop | Type | Description |
|---|---|---|
asChild | boolean | Render the child element as the button (Radix Slot) instead of a <button>. |
Theming
The tokens each state resolves to. Change the token and every theme follows.
| State | Token |
|---|---|
| current | the in-force workspace appends a WORD into the row meta, so it reaches the option's accessible name |
| empty | the free-text path submit is aria-disabled, never natively disabled, so it stays a focusable tab stop |