AI Agent Roster
elements/agent-rosterFreeComponent
Display a directory of AI agents with status indicators, match patterns, and selection support. Supports grid and list layouts for multi-agent orchestration UIs.
Install it
npx shadcn@latest add https://www.tryelements.dev/r/agent-roster.jsonSource
1"use client";23import * as React from "react";45import {6 Bot,7 Check,8 ChevronRight,9 Clock,10 Cpu,11 Loader2,12 Power,13} from "lucide-react";1415import { cn } from "@/lib/utils";1617type AgentStatus = "active" | "idle" | "busy" | "offline";1819interface RosterAgent {20 id: string;21 name: string;22 description?: string;23 matchOn?: string[];24 status: AgentStatus;25 icon?: React.ReactNode;26 model?: string;27}2829interface AiAgentRosterContextValue {30 agents: RosterAgent[];31 activeAgentId?: string;32 layout: "grid" | "list";33 onSelect?: (agentId: string) => void;34}3536const AiAgentRosterContext =37 React.createContext<AiAgentRosterContextValue | null>(null);3839function useAgentRosterContext() {40 const context = React.useContext(AiAgentRosterContext);41 if (!context) {42 throw new Error(43 "AiAgentRoster components must be used within <AiAgentRoster>",44 );45 }46 return context;47}4849interface AiAgentRosterProps {50 agents: RosterAgent[];51 activeAgentId?: string;52 onSelect?: (agentId: string) => void;53 layout?: "grid" | "list";54 children?: React.ReactNode;55 className?: string;56}5758function AiAgentRoster({59 agents,60 activeAgentId,61 onSelect,62 layout = "grid",63 children,64 className,65}: AiAgentRosterProps) {66 const contextValue = React.useMemo(67 () => ({ agents, activeAgentId, layout, onSelect }),68 [agents, activeAgentId, layout, onSelect],69 );7071 return (72 <AiAgentRosterContext.Provider value={contextValue}>73 <div74 data-slot="ai-agent-roster"75 data-layout={layout}76 className={cn(77 "rounded-lg border border-border bg-card text-card-foreground",78 className,79 )}80 >81 {children || <AiAgentRosterContent />}82 </div>83 </AiAgentRosterContext.Provider>84 );85}8687interface AiAgentRosterHeaderProps {88 children?: React.ReactNode;89 className?: string;90}9192function AiAgentRosterHeader({93 children,94 className,95}: AiAgentRosterHeaderProps) {96 const { agents } = useAgentRosterContext();9798 const activeCount = React.useMemo(99 () =>100 agents.filter((a) => a.status === "active" || a.status === "busy").length,101 [agents],102 );103104 return (105 <div106 data-slot="ai-agent-roster-header"107 className={cn(108 "flex items-center justify-between border-b border-border px-4 py-3",109 className,110 )}111 >112 <div className="flex items-center gap-2">113 <div className="flex size-8 shrink-0 items-center justify-center rounded-md bg-muted">114// … truncated
What it pulls in
npm packages
Files it writes
More from elements
All 359 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Ably Logoably-logo | elements | Components | Free | no deps | |
| AI Agent Contextagent-context | elements | Components | Free | 2 deps | |
| AI Agent Statusagent-status | elements | Components | Free | 1 dep | |
| Algolia Logoalgolia-logo | elements | Components | Free | no deps | |
| Amp Logoamp-logo | elements | Components | Free | no deps | |
| Anthropic Logoanthropic-logo | elements | Components | Free | no deps | |
| Antigravity Logoantigravity-logo | elements | Components | Free | no deps | |
| API Response Viewerapi-response-viewer | elements | Components | Free | no deps |
