Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: set filtering state of select #179

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

PJGaetan
Copy link
Contributor

@PJGaetan PJGaetan commented Apr 5, 2024

This PR adresse the following issue #173

It allows allows use the select where the filter mode is activated when Run starts.

Thanks for telling me to also update the focus @maaslalani !

I have the following results with this code (readme example adapted a little).

package main

import (
	"fmt"

	"github.com/charmbracelet/huh"
)

func main() {
	var country string
	s := huh.NewSelect[string]().
		Title("Pick a country.").
		Filtering(true).
		Options(
			huh.NewOption("United States", "US"),
			huh.NewOption("Germany", "DE"),
			huh.NewOption("Brazil", "BR"),
			huh.NewOption("Canada", "CA"),
		).
		Value(&country)

	huh.NewForm(huh.NewGroup(s)).Run()

	fmt.Println("You chose ", country)
}

demo

@maaslalani maaslalani merged commit 7923781 into charmbracelet:main Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants