← All components
Interaction / component

Model Selector

A searchable grouped model picker with caller-owned choices and a draft-preserving prompt composer.

Live preview
Preparing preview…

Take it with you.

SOURCE ACCESS

Preview freely. Unlock the files.

Enter the shared password to copy the complete source, download every file, and install components in your app.

Access lasts 24 hours. Your preview settings stay with you.

Component notes

  • Options and value belong to the caller. No provider catalog, pricing, availability or model response is fetched. Example configurations are explicitly illustrative.
  • Search covers option name, provider and description. Arrow keys move through enabled choices; Enter requests one selection. Modal focus is trapped and dismissal returns focus.
  • Missing onValueChange disables choices while keeping search/dismissal usable. Controlled open without onOpenChange disables the trigger and mounts no modal. Unknown, disabled or removed values show unavailable without choosing a replacement.
  • The prompt composer prepares a real local summary of the selected label and entered prompt; it does not call a model. Pause/Replay and appearance changes preserve draft, choice and summary. Reset restores the sample.
  • Up to256 unique options; own string fields only, id128/name200/provider200/description1000. First valid duplicate wins. Scoped comfortable/compact rows remain at least44px high. Caller ReactNode icons remain opaque; consumers own valid cleared node content. No remote provider logo is fetched.
React19.2Modern browsers

AI Elements — Vercel, Inc. · Apache-2.0; full notice retained.

shadcn/ui · MIT; full notice retained.

cmdk · MIT; full notice retained.

Radix UI · MIT; full notice retained.

Geist · SIL Open Font License1.1; bundled font and notice.

Props

PropTypeDefaultDescription
options (required)readonly ModelOption[]requiredCaller options: id, name, provider, optional description/disabled/icon. Up to256 unique own records; id128/name200/provider200/description1000. No provider catalog or logo request.
value (required)string | nullrequiredAuthoritative caller selection; null uses placeholder. Unknown/removed/disabled selection is unavailable with no replacement callback.
onValueChange(id: string) => voidundefinedExplicit enabled-item selection request. Missing callback disables choices while configured dialog search/dismissal stays usable.
openbooleanundefinedOptional authoritative dialog state. Requires onOpenChange, otherwise trigger is disabled and no dialog mounts.
onOpenChange(open: boolean) => voidundefinedUser dialog open/dismiss request. Omitted open allows local state.
disabledbooleanfalseDisables the trigger and prevents opening.
placeholderstringChoose a modelTrigger text when caller value is null.
searchPlaceholderstringSearch modelsSearch input placeholder.
triggerLabelstringundefinedAccessible trigger name; omitted uses the visible selected/placeholder text.
showDescriptionsbooleantrueIncludes caller description under each option.
densitycomfortable | compactcomfortableScoped row density; both retain at least44px targets.
classNamestringundefinedAdditional scoped trigger class.