Better Defaults!
Huh? v0.2.3
fixes some bugs for more consistent behaviour across inputs 🐞
Text
inputs now update values on each keystroke rather than onBlur
for consistency.Select
andMultiSelect
read their default values from the initial values set by theValue
variable if provided.
A special thanks to @vitor-mariano for all his contributions to this release 🤗
Defaults Example
You can now have preselected options by declaring them in the Value
variable:
var toppings = []string{"Lettuce", "Tomatoes"}
var options = huh.NewOptions("Lettuce", "Tomatoes", "Charm Sauce", "Cheese", "Vegan Cheese")
huh.NewMultiSelect[string]().Title("Toppings").Options(options...).Value(&toppings).Run()
In the above example, Lettuce
and Tomatoes
will be preselected by default.
What's Changed
Text
value updates by @vitor-mariano in #64- Prefill
Select
andMultiSelect
inputs with default values by @vitor-mariano in #62
Full Changelog: v0.2.2...v0.2.3
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.