Getting Started
Components
- Agent Status
- Agent Template Card
- API Key Card
- Audio Player
- Bar Visualizer
- Channel Status Card
- Chat Composer
- Code Editor
- Condition Builder
- Confirm Dialog
- Conversation
- Conversation Bar
- Dataset Card
- Document Status Badge
- Extraction Strategy Select
- File Icon
- File Upload
- Indexing Progress
- Live Waveform
- Matrix
- Message
- Mic Selector
- Model Diff View
- Model Selector
- Model Type Filter
- Node Catalog
- Option Editor
- Orb
- Output Variables View
- Package Card
- Prompt Editor
- Provider Status Card
- Radio Card
- Resource Card
- Resource Sidebar
- Response
- Run Node List
- Scrub Bar
- Segment Card
- Shimmering Text
- Speech Input
- Token Trend Chart
- Tool Call Card
- Transcript Viewer
- Usage Stat Card
- Variable Binding Editor
- Variable Selector
- Voice Button
- Voice Picker
- Waveform
- Workflow Node Card
- Workspace Selector
Workspace Selector
A searchable workspace selector for console headers, dialogs, and ownership fields.
import { WorkspaceSelector } from "@/components/ui/workspace-selector"
const workspaces = [
{
id: "support",
name: "Support Ops",
description: "Customer support agents and billing workflows.",
},
{
id: "commerce",
name: "Commerce",
description: "Sales assistants, product catalog, and order automations.",
},
{
id: "internal",
name: "Internal Tools",
description: "Team productivity agents and knowledge bases.",
},
]
export function WorkspaceSelectorDemo() {
return (
<WorkspaceSelector
className="w-full max-w-sm"
options={workspaces}
value="support"
/>
)
}
Installation
pnpm dlx shadcn@latest add https://ui.zgi.ai/r/workspace-selector.jsonpnpm dlx shadcn@latest add https://ui.zgi.ai/r/workspace-selector.json
yarn dlx shadcn@latest add https://ui.zgi.ai/r/workspace-selector.jsonComponent
"use client"
import * as React from "react"
import {
Building2Icon,
CheckIcon,
ChevronsUpDownIcon,
SearchIcon,
} from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import {
Command,
CommandEmpty,
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
export interface WorkspaceSelectorOption {
id: string
name: string
description?: string
disabled?: boolean
}
export interface WorkspaceSelectorProps {
options: WorkspaceSelectorOption[]
value?: string
onValueChange?: (value: string, option: WorkspaceSelectorOption) => void
placeholder?: string
searchPlaceholder?: string
emptyText?: string
disabled?: boolean
className?: string
contentClassName?: string
}
export function WorkspaceSelector({
options,
value,
onValueChange,
placeholder = "Select workspace",
searchPlaceholder = "Search workspaces...",
emptyText = "No workspaces found.",
disabled = false,
className,
contentClassName,
}: WorkspaceSelectorProps) {
const [open, setOpen] = React.useState(false)
const selected = options.find((option) => option.id === value)
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
type="button"
variant="outline"
role="combobox"
aria-expanded={open}
disabled={disabled}
className={cn(
"h-10 w-full justify-between rounded-md px-3 font-normal",
!selected && "text-muted-foreground",
className
)}
>
<span className="flex min-w-0 items-center gap-2">
<Building2Icon className="size-4 shrink-0" />
<span className="truncate">{selected?.name ?? placeholder}</span>
</span>
<ChevronsUpDownIcon className="text-muted-foreground size-4 shrink-0" />
</Button>
</PopoverTrigger>
<PopoverContent
align="start"
className={cn("w-[min(360px,calc(100vw-2rem))] p-0", contentClassName)}
>
<Command>
<div className="border-b px-3">
<div className="flex items-center">
<SearchIcon className="text-muted-foreground mr-2 size-4" />
<CommandInput
placeholder={searchPlaceholder}
className="h-10 border-0 px-0 focus:ring-0"
/>
</div>
</div>
<CommandList className="max-h-72">
<CommandEmpty>{emptyText}</CommandEmpty>
{options.map((option) => (
<CommandItem
key={option.id}
value={`${option.name} ${option.description ?? ""}`}
disabled={option.disabled}
onSelect={() => {
onValueChange?.(option.id, option)
setOpen(false)
}}
className="items-start gap-3 py-3"
>
<CheckIcon
className={cn(
"mt-0.5 size-4 shrink-0",
value === option.id ? "opacity-100" : "opacity-0"
)}
/>
<span className="min-w-0 flex-1">
<span className="block truncate text-sm font-medium">
{option.name}
</span>
{option.description ? (
<span className="text-muted-foreground mt-0.5 line-clamp-2 block text-xs leading-5">
{option.description}
</span>
) : null}
</span>
</CommandItem>
))}
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
Usage
import { WorkspaceSelector } from "@/components/ui/workspace-selector"
export function Example() {
return (
<WorkspaceSelector
value="support"
options={[{ id: "support", name: "Support Ops" }]}
/>
)
}Props
| Prop | Type | Default |
|---|---|---|
| options | WorkspaceSelectorOption[] | required |
| value | string | - |
| onValueChange | (value, option) => void | - |
| placeholder | string | "Select workspace" |
| searchPlaceholder | string | "Search workspaces..." |
| emptyText | string | "No workspaces found." |
| disabled | boolean | false |
Deploy and Scale Agents with ZGI
ZGI delivers the infrastructure and developer experience you need to ship reliable audio & agent applications at scale.
Talk to an expert