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: add GetFocused to field_input #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SpyMachine
Copy link

My use case is that I have a field that I'd like to update suggestions for based on what the user has input. When the user starts typing, a search endpoint is hit with the current value of the field as the query parameter and the suggestions is updated based off the returned search.

So basically, in my Update I want to check if the field is focused and then if a new key was pressed to hit the endpoint and update the suggestions.

@maaslalani
Copy link
Contributor

Hey @SpyMachine, we are going to introduce Dynamic Inputs in #233 which I think will solve your use case here: essentially you'll be able to set the SuggestionsFunc based on the value of the input.

@maaslalani
Copy link
Contributor

Hey @SpyMachine, dynamic inputs are now merged. Let me know if this example is what you were trying to accomplish:

https://github.com/charmbracelet/huh/blob/main/examples/dynamic/dynamic-suggestions/main.go

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.

2 participants