Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-workspace-switcher.json --yes

Workspace switcher

Pro

The menu that shows the current workspace and switches to another or creates one, for React and Tailwind CSS. Part of Goop Pro.

Open the switcher: type in its search field to narrow nine workspaces and press Enter, or press a row’s ⌘1–⌘9. The summary says while the switcher is open; the spinner shows while it switches; Closed Archive refuses, the pick is undone and the red mark says why. Look shows it under the pages’ own workspace button, with a long name, across a phone drawer, or as the tile alone. The workspaces, the wait and the refusal are our own sample: nothing is switched.

When to use

  • The menu that shows the current workspace and switches to another or creates one.
  • Also called: team switcher or org switcher.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Workspace switcher on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-workspace-switcher.json --yes
PROMPT
Add the Goop Workspace switcher to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { useState } from 'react';
import {
  WorkspaceSwitcher,
  WorkspaceSwitcherAction,
  WorkspaceSwitcherContent,
  WorkspaceSwitcherItem,
  WorkspaceSwitcherLabel,
  WorkspaceSwitcherTrigger,
} from '@/components/ui/goop/workspace-switcher';

const WORKSPACES = [
  { id: 'fieldwork', name: 'Fieldwork', detail: '9 members' },
  { id: 'home', name: 'Home', detail: '1 member' },
  { id: 'reading-group', name: 'Reading group', detail: '4 members' },
];

function Workspaces({ onCreate }: { onCreate: () => void }) {
  const [current, setCurrent] = useState('fieldwork');
  const now = WORKSPACES.find((one) => one.id === current) ?? WORKSPACES[0];
  return (
    <WorkspaceSwitcher value={current} onValueChange={setCurrent}>
      <WorkspaceSwitcherTrigger name={now.name} tileOnly />
      <WorkspaceSwitcherContent>
        <WorkspaceSwitcherLabel>Switch workspace</WorkspaceSwitcherLabel>
        {WORKSPACES.map((one) => (
          <WorkspaceSwitcherItem key={one.id} value={one.id} name={one.name} detail={one.detail} />
        ))}
        <WorkspaceSwitcherAction onSelect={onCreate} />
      </WorkspaceSwitcherContent>
    </WorkspaceSwitcher>
  );
}
  • Fits: frame: switcher.
  • Also known as: TeamSwitcher, OrgSwitcher, WorkspaceMenu, TenantPicker.
  • Never hand-wire a MenuButton and a DropdownMenu for it.
  • height, width, padding, corner, border, background, text: add no class for these.

API reference

  • Each option with its sentence: workspace-switcher--options.md
  • State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange); drawn by data-focus-visible, data-disabled
Parts
PartWhat it is
WorkspaceSwitcherTriggerThe button that opens the switcher, the theme's MenuButton shape="rounded"; its props: workspace-switcher--trigger.md
WorkspaceSwitcherContentThe menu the trigger opens (role="menu", named "Workspaces"); its props: workspace-switcher--content.md
WorkspaceSwitcherLabelThe heading over the workspaces, "Workspaces" when given no words
WorkspaceSwitcherItemOne workspace (role="menuitemradio"); its props: workspace-switcher--item.md
WorkspaceSwitcherActionThe menu's last row, under a line of its own; icon?: IconName | null = 'plus'; also takes onSelect?: (event: Event) => void; disabled?: boolean; asChild?: boolean
  • data-slot values (to select a part by): workspace-switcher-empty, workspace-switcher-header, workspace-switcher-item, workspace-switcher-item-description, workspace-switcher-item-label, workspace-switcher-item-shortcut, workspace-switcher-item-text, workspace-switcher-label, workspace-switcher-status, workspace-switcher-status-icon, workspace-switcher-trigger

WorkspaceSwitcherContent

The menu the trigger opens (role="menu", named "Workspaces").

TSX
import { WorkspaceSwitcherContent } from '@/components/ui/goop/workspace-switcher';

Options

  • search?: boolean — A search field over the rows that narrows the workspaces as you type (by name and detail); the menu opens with the focus in it.
  • searchPlaceholder?: string = 'Find a workspace…' — The search field's grey words while it is empty (default "Find a workspace…").
  • searchLabel?: string = 'Find a workspace' — The search field's name for a screen reader (default "Find a workspace").
  • empty?: ReactNode = 'No workspace matches' — The line shown while no workspace matches the search (default "No workspace matches").
  • defaultSearch?: string = '' — The words the search field holds as the menu opens (empty when left out).
  • Also takes: container?: HTMLElement | null

WorkspaceSwitcherItem

One workspace (role="menuitemradio").

TSX
import { WorkspaceSwitcherItem } from '@/components/ui/goop/workspace-switcher';

Options

  • fill?: string — The workspace's own colour, any CSS colour, winning over a hue; its initials stay light.
  • hue?: 'blue' | 'green' | 'orange' | 'pink' | 'red' | 'yellow' | 'neutral' — One of the six hue words (or neutral, the grey) instead of a fill, readable in light and dark; left out (and no fill), Meadow's pink.
  • initials?: string — One or two letters in the tile; left out, the name's first letters (one on the small tiles).
  • image?: string — The address of the workspace's picture, drawn over its initials once it has loaded.
  • value: string — The workspace's id: the switcher's value while it is the current one.
  • name: string — The workspace's name.
  • detail?: ReactNode — A grey line under the name: its members ("4 members"), its plan or the person's role there.
  • shortcut?: string — The row's chord (mod+1; mod is ⌘ on an Apple keyboard, Ctrl elsewhere): drawn at the row's end in the page's own keys, it switches to this workspace while the menu is open, or from anywhere with the switcher's shortcuts="page".
  • Also takes: disabled?: boolean

WorkspaceSwitcher: every option

TSX
import { WorkspaceSwitcher } from '@/components/ui/goop/workspace-switcher';

Options

  • value?: string — The current workspace's id, held by the caller (with onValueChange).
  • defaultValue?: string — The current workspace's id when the switcher holds it itself.
  • onValueChange?: (value: string) => unknown — Called with the id of the workspace picked; the menu then closes.
  • status?: 'idle' | 'switching' | 'failed' — The switch's status held by the caller (switching, failed or idle), in place of the promise's.
  • shortcuts?: 'menu' | 'page' | 'off' = 'menu' — Whether a row's drawn shortcut switches to it: menu (the default) while the menu is open, page from anywhere on the page too, off never (your own code listens).
  • switchingMessage?: (name: string) => string — What a screen reader hears as a switch starts; default "Switching to <name>".
  • failedMessage?: (name: string) => string — What a screen reader hears, and the trigger's title says, when a switch is refused; default "Could not switch to <name>".
  • open?: boolean — The menu open, held by the caller (with onOpenChange).
  • defaultOpen?: boolean — Open when it first draws.
  • onOpenChange?: (open: boolean) => void — Called as the menu opens and closes.
  • modal?: boolean — Whether the rest of the page is shut off while the menu is open (the menu's own default, true).
  • children?: ReactNode — A WorkspaceSwitcherTrigger, then a WorkspaceSwitcherContent.
  • State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange); drawn by data-focus-visible, data-disabled

WorkspaceSwitcherTrigger

The button that opens the switcher, the theme's MenuButton shape="rounded".

TSX
import { WorkspaceSwitcherTrigger } from '@/components/ui/goop/workspace-switcher';

Options

  • fill?: string — The workspace's own colour, any CSS colour, winning over a hue; its initials stay light.
  • hue?: 'blue' | 'green' | 'orange' | 'pink' | 'red' | 'yellow' | 'neutral' — One of the six hue words (or neutral, the grey) instead of a fill, readable in light and dark; left out (and no fill), Meadow's pink.
  • initials?: string — One or two letters in the tile; left out, the name's first letters (one on the small tiles).
  • image?: string — The address of the workspace's picture, drawn over its initials once it has loaded.
  • name: string — The current workspace's name, beside its tile: the button's name.
  • tileOnly?: boolean = false
  • Also takes: type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean

Keyboard

KeyWhat it does
EnterOn the trigger: open, the first row active
SpaceOn the trigger: open, the first row active
ArrowDownOn the trigger: open, the first row active
ArrowUpOn the trigger: open, the last row active
ArrowDown ArrowUpMove the active row, looping past either end
Home EndFirst or last row
EnterPick the active row (a workspace becomes current) and close
EscapeClose, the focus back on the trigger
TabClose

Accessibility

  • The behaviour layer under the part answers keys, focus and dismissal: never write your own.

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
focus-visiblethe attribute data-focus-visible
disabledthe attribute data-disabled

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/meadow/components/workspace-switcher.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-workspace-switcher.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.