Skip to content
Agent UI
Pickers & navigationProviderSelector

Provider Selector

Segmented provider pills with logo, label, and pressed state.

ProviderSelector ships with a full API table, a copyable example, and accessibility notes.

tsx

Installation

Install the package once, then import ProviderSelector from its direct entry point or from the root.

bash
pnpm add @agent-ui/react
tsx
import { ProviderSelector } from "@agent-ui/react/provider-selector";

Tailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.

Usage

The example below is the same code that renders the preview. Copy it, swap in your own handlers, and ship.

tsx
import { ProviderSelector } from "@agent-ui/react";
 
<ProviderSelector
providers={providers}
selectedId={provider}
onChange={(p) => setProvider(p.id)}
/>

API reference

Every prop ProviderSelector accepts, its type, default, and behaviour.

API reference for this component
NameTypeDefaultDescription
providersProviderOption[]—Options with id, name, optional logo.
selectedIdstring—Controlled selection.
onChange(provider: ProviderOption) => void—Selection callback.
classNamestring—Inherits every native div attribute, including id, aria-*, data-*, onClick, and style.

Accessibility

Pills expose aria-pressed and keep a visible focus ring.
Use it with the rest of the library

ProviderSelector composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.

7 lines · copy-ready