Skip to content

select: support number key to jump to option #475

@gutenye

Description

@gutenye

Feature Request

Allow pressing number keys (1-9) to jump to and select the corresponding option in the select prompt.

Current Behavior

Users must use arrow keys to navigate options and press Enter to confirm.

Proposed Behavior

When a select prompt has numbered options, pressing a number key (e.g. 1, 2, 3) should immediately jump to and select that option

This is especially useful for short lists (< 10 items) where pressing a single key is much faster than arrow-key navigation.

Example

const answer = await select({
  message: 'Pick a market',
  options: [
    { label: 'Market 1' },
    { label: 'Market 2' },
    { label: 'Market 3' },
  ],
})
// Pressing "2" immediately selects "Market 2"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions