Select

Basic Usage

result, _ := pterm.DefaultInteractiveSelect.
WithOptions([]string{"a", "b", "c", "d"}).
Show()
pterm.Info.Printfln("You answered: %s", result)

Options

Name
Type
Description
DefaultText
string
Default prompt text
TextStyle
*Style
Style of the prompt text
Options
[]string
List of menu options
OptionStyle
*Style
Style of menu options
DefaultOption
string
The option that is selected by default
MaxHeight
int
Maximum number of visible options at once (the others can be accessed by scrolling)
Selector
string
Character of the selector
SelectorStyle
*Style
Style of the Selector

Using Options

Methods

Method
Description
Show(text)
Displays the interactive select menu

Full Specification

pkg.go.dev contains the full specification for this printer and more technical descriptions.
pterm package - github.com/pterm/pterm - Go Packages
Copy link
Edit on GitHub
On this page
Basic Usage
Options
Using Options
Methods
Full Specification