Additional Field Types
I have a framework to describe application's input parameters in YAML, and use that to generate CLI flags/REST endpoints/HTML forms and much more, and I was about to write a TUI widget to render them with bubbletea. Here are a list of the widgets I need to build to support my tool:
- checkbox
- integer/float/string/bool lists
- date
- file/multi-file select
- key value entry
I was wondering if you had any plans to implement these (and thus a design in mind), or if I should just go ahead and build my own and keep them say, in a separate library?
Here's a proof of concept: https://asciinema.org/a/ndG2OO2XqjYtenE5x9LYLRKvh
Here's my framework: https://github.com/go-go-golems/glazed
Date and File selects are definitely on the roadmap (no eta yet).
I'm curious what you expect checkboxes to look like? Perhaps they can be tweaked by the theme to get the style you want on a multi-select list. Maybe we can implement this as an alternative view on NewConfirm or its own field NewCheckbox.
integer/float/string/bool lists should be implemented on select and multi-selects by simply changing the generic type: see the the following example (which uses a custom enum and can be swapped for any type)
https://github.com/charmbracelet/huh/blob/main/examples/burger/main.go#L106-L112
good idea on doing checkboxes with a multiselect list!
The lists I am talking about are dynamic, in that people can enter say, product ids, or a list of prices. I am using these forms mostly as search forms for ecommerce queries right now.
I think we can consider adding lists as well, for now I would highly recommend using a NewText and allowing the user to enter each item on a new line or a NewInput and having the lists comma separated.
I think the UX of a list could be quite better since then you could dynamically display them and validate each item so we can consider adding it, it would also make editing for the user easier as they could delete items very easily.
Yeah, that is a good first option, and I am not sure yet either what widget would work for me. Anyway, it's easy to add fields in my own package, it'll give you an opportunity to pick and choose.
Also it would be nice to have "select" that operates like the confirm. with the buttons.
Also it would be nice to have "select" that operates like the confirm. with the buttons.
We've added an Inline option for Select which does something along these lines, not with buttons but rather with a horizontally scrolling options list with one option displayed at a time.
Just an update on this issue, FilePicker field was added to Huh?!