Skip to main content

SelectProps <T, V>

Hierarchy

Index

Properties

optionaldefaultSelected

defaultSelected?: T

Option value selected by default.

label

label: NonNullable<ReactNode>

Label to display before or above the prompt itself.

optionallimit

limit?: number

Number of options to display before scrolling. Defaults to console height.

onSubmit

onSubmit: (value: T) => void

Callback triggered when the value is submitted.

options

options: (V | SelectOptionLike<V>)[]

List of options to choose from. Can either be a string, number, or object with a label and value.

optionaloverflowAfterLabel

overflowAfterLabel?: OverflowLabel

Label to display above scrollable options with the number of overflowing options.

optionaloverflowBeforeLabel

overflowBeforeLabel?: OverflowLabel

Label to display below scrollable options with the number of overflowing options.

optionalprefix

prefix?: string

Single character symbol to display before the label. Defaults to "?"".

optionalscrollType

scrollType?: cycle | overflow

The pattern in which to limit options when scrolling. Defaults to overflow.

  • cycle - Will continously cycle through options, even when navigating to and past edges.
  • overflow - Will display options bound to an edge, with the number of options hidden above and below.

optionalvalidate

validate?: (value: T) => void

Function to validate the value on submit. To trigger a failed state, thrown an Error.