$ 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

PropTypeDefaultDescription
messagestringrequiredPrompt question displayed above options
optionsSelectOption<T>[]requiredArray of { label, value, description?, disabled? }
initialIndexnumber0Initially highlighted option index
pointerstring"❯"Pointer character for active option
activeColorstringfg.cyanColor for the highlighted option
maxVisiblenumber10Max visible options before scrolling