$ Select
interactiveasync
Interactive keyboard-navigated menu with scrolling, descriptions, disabled options, and vim key bindings (j/k).
# Preview
select demo
? Pick a framework:
❯ React - Meta's UI library
Vue - Progressive framework
Svelte - Compiled framework
- Angular (disabled)
↑↓ to navigate, Enter to select, Ctrl+C to cancel
✔ Pick a framework: → React
# Usage
example.ts
import { select } from "@vr_patel/tui";
const choice = await select({
message: "Pick a framework:",
options: [
{ label: "React", value: "react", description: "Meta's UI library" },
{ label: "Vue", value: "vue", description: "Progressive framework" },
{ label: "Svelte", value: "svelte", description: "Compiled framework" },
{ label: "Angular", value: "angular", disabled: true },
],
});
console.log(`You chose: ${choice}`);# API
| Prop | Type | Default | Description |
|---|---|---|---|
| message | string | required | Prompt question displayed above options |
| options | SelectOption<T>[] | required | Array of { label, value, description?, disabled? } |
| initialIndex | number | 0 | Initially highlighted option index |
| pointer | string | "❯" | Pointer character for active option |
| activeColor | string | fg.cyan | Color for the highlighted option |
| maxVisible | number | 10 | Max visible options before scrolling |