TUIpick

pick

Single-select menu with keyboard navigation

Quick Start

main.py
from connectonion.tui import pick choice = pick("Pick a color", ["Red", "Green", "Blue"]) # Press 1 → "Red", 2 → "Green", 3 → "Blue" # Or use arrow keys + Enter
output
Pick a color
 
❯ 1 Red
2 Green
3 Blue
 
↑↓ navigate 1-9 jump Enter select

Options

Simple List

main.py
choice = pick("Select model", ["gpt-4", "claude-3", "gemini"]) # Returns: "gpt-4" (selected string)

With Descriptions

main.py
choice = pick("Send email?", [ ("Yes, send it", "Send immediately"), ("Auto approve", "Skip approval for this recipient"), ("No", "Cancel"), ])

With "Other" Option

main.py
choice = pick("Continue?", ["Yes", "No"], other=True) # Adds "Other..." option for custom text input

Keyboard Controls

KeyAction
↑/↓Navigate up/down
1-9Jump to option
EnterConfirm selection
EscCancel

API

main.py
pick( title: str, # Question to display options: list, # Strings or (label, description) tuples other: bool = False, # Add "Other..." option console: Console = None ) -> str # Returns selected label

Example Output

Pick a color

  ❯ 1  Red
    2  Green
    3  Blue

↑↓ navigate  1-9 jump  Enter select

Star us on GitHub

If ConnectOnion saves you time, a ⭐ goes a long way — and earns you a coffee chat with our founder.