Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xranx OpenContext ModelSelector

From Leeroopedia
Knowledge Sources
Domains UI, React
Last Updated 2026-10-24 00:00 GMT

Overview

Dropdown selector component for choosing AI models in the desktop UI, with click-outside dismissal, selected state highlighting, and empty state handling.

Description

The ModelSelector component in src/ui/src/components/ renders a compact dropdown button that opens a scrollable list of model options. It tracks an open/closed state, closes on outside clicks via a ref-based event listener, highlights the currently selected option with a checkmark, and shows a placeholder when no value is set. The dropdown opens upward (bottom-full) for use in input bars.

Usage

Import this component in agent input bars and settings screens where users select an AI model.

Code Reference

Source Location

Signature

export function ModelSelector({
  value, options, onChange, disabled,
  placeholder, className
})
// options: Array<{ value: string, label: string }>

Import

import { ModelSelector } from './components/ModelSelector';

I/O Contract

Inputs

Name Type Required Description
value string Yes Currently selected model value
options Array<{value,label}> Yes Available model options
onChange Function Yes Called with selected value
disabled boolean No Disable selector
placeholder string No Text when no value

Outputs

Name Type Description
JSX React.Element Dropdown button with model list

Usage Examples

Model Selection in Agent Bar

import { ModelSelector } from './components/ModelSelector';

const models = [
  { value: 'gpt-5.2-codex', label: 'GPT-5.2 Codex' },
  { value: 'gpt-5.1-codex-max', label: 'GPT-5.1 Codex Max' },
];

<ModelSelector
  value={session.model || ''}
  options={models}
  onChange={(val) => updateSessionModel(val)}
  disabled={isGenerating}
  placeholder="Select model"
  className="max-w-[140px]"
/>

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment