Open
Description
Screenshot:
(Without this newline, the Next button show on the same line after the description, looks weird)
Code:
func Note() (string, error) {
theme := huh.ThemeCharm()
keymap := huh.NewDefaultKeyMap()
choice := true
err := huh.NewForm(
huh.NewGroup(
huh.NewNote().
Title("This is title or rather header").
Description("Some words to show").
Next(true).
NextLabel("ACK").
Height(5),
),
).
WithWidth(Width).
WithHeight(Height).
WithTheme(theme).
WithKeyMap(keymap).
WithShowHelp(ShowHelp).
// WithTimeout(5 * time.Second).
//WithProgramOptions(tea.WithAltScreen()).
Run()
// run
fmt.Println("Value:", choice)
if err != nil {
isAbortErr := errors.Is(err, huh.ErrUserAborted)
if isAbortErr {
return "ABORTED", nil
}
return es, err
}
return fmt.Sprintf("%t", choice), nil
}
Activity