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

Feature Request: Expose which input is focused #492

Open
mdbenjam opened this issue Dec 6, 2024 · 0 comments · May be fixed by #503
Open

Feature Request: Expose which input is focused #492

mdbenjam opened this issue Dec 6, 2024 · 0 comments · May be fixed by #503

Comments

@mdbenjam
Copy link

mdbenjam commented Dec 6, 2024

Is your feature request related to a problem? Please describe.
When integrating Huh into a larger bubble tea application it's sometimes useful to change behavior based on the selected field in a form. Some examples:

  1. We're building a form with a lot of fields and have decided to split the form up and put each sub form into a tab component. It would be helpful to know when a user has focused the last field on a form so that our tab component could respond to the next tab key press to move the user into the next tab with the next section of the form.
  2. We may want to show more information about a field in a side panel next to the form, such as documentation or other helpful information that's too large to fit into the form itself.

Describe the solution you'd like
I'd like to have a GetFocusedField function on the form to return the current field (either the entire field struct, or at least the key), and it's relative position in the form and group.

Describe alternatives you've considered

Additional context
Here's an example of the form in tab component:
Screenshot 2024-12-06 at 9 44 20 AM

Loving the library, it makes creating rich TUI forms so easy!

@jonas-grgt jonas-grgt linked a pull request Jan 5, 2025 that will close this issue
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 a pull request may close this issue.

1 participant