Option List
An inline multi-choice selection list (5–7 options then paginate) for human-in-the-loop agent inquiries — distinct from quick-reply suggestion chips.
Option List
The Option List is an inline multi-choice selection list presented in a chat / agent turn for the user to pick from — distinct from quick-reply suggestion chips. It shows up to pageSize (5–7) options at a time and paginates longer lists. The chosen option is meant to feed back into your agent inquiry loop — for example a local human-in-the-loop disambiguation step (optionally useAgent).
It is presentational; the agent loop is owned by the consumer.
When to use it: when a local agent needs the user to disambiguate among several candidates ("Which file did you mean?") before continuing.
Preview
Installation
pnpm dlx shadcn@latest add @localmode/ui/input-controls/option-listnpx shadcn@latest add @localmode/ui/input-controls/option-listyarn dlx shadcn@latest add @localmode/ui/input-controls/option-listbunx --bun shadcn@latest add @localmode/ui/input-controls/option-listDependencies
- Data source: renders the
optionsyou pass and emits theonSelectcallback — works with any backend or agent loop. Recommended LocalMode producer:useAgentinquiry/human-in-the-loop (optional). lucide-react— the pagination iconsclsx+tailwind-merge— via the sharedcn()util (installed automatically)
Files installed
option-list.tsx— the componentlib/utils.ts— thecn()helper (if not already present)
Props
OptionList
Prop
Type
Examples
Feed a useAgent inquiry
import { OptionList } from '@/components/option-list';
export function Disambiguator({ candidates, onPick }) {
return (
<OptionList
prompt="Which file did you mean?"
options={candidates}
onSelect={(opt) => onPick(opt.id)} // resume the agent loop with the choice
/>
);
}Custom page size
<OptionList options={options} onSelect={onSelect} pageSize={5} />Customization
Lists longer than pageSize paginate automatically with Prev / Next controls. Each option can carry a description for a secondary line. Pass selectedId to render the chosen option as active. Everything is theme-driven via shadcn/ui CSS variables — edit the copied file to change the row layout or add keyboard navigation.
Slash Command Palette
A "/"-triggered command palette over a local tool/command list — name, category, description, and icon — to layer onto a PromptInput Tools slot.
Prompt Enhance Button
A one-click "enhance my prompt" control that rewrites the user's draft with a local model — fully offline — with an optional few-shot example editor.