bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

Select, multi-select and multiline answer components

Open chriswalz opened this issue 5 years ago • 5 comments

Also a multiline answer. I would definitely see myself using them on https://github.com/chriswalz/bit.

Right now I'm using https://github.com/AlecAivazis/survey

chriswalz avatar Oct 30 '20 14:10 chriswalz

Agreed, these are desperately needed as a standard bubbles and we're working on it!

Just as a heads up: in the meantime you can already find a custom select example in bubble tea: https://github.com/charmbracelet/bubbletea/blob/master/examples/views/main.go

muesli avatar Oct 30 '20 14:10 muesli

I already implemented a select-component (not mutli-select though) based on bubbletea over here: https://github.com/erikgeiser/promptkit

It has the following features:

  • Pagination
  • Filtering
  • Custom styling (with color/style support via https://github.com/muesli/termenv)
  • Custom choice types
  • Proper wrapping for small terminals via https://github.com/muesli/reflow

Currently it is not ready because:

  • ~~It depends on my PR in reflow: https://github.com/muesli/reflow/pull/30 (currently I use a local redirect in the go.mod)~~ merged
  • ~~I just finished it and didn't test it exhaustively~~ played around for a bit
  • ~~I'd like the keyboard shortcuts to be configurable~~ done
  • ~~SliceChoices only works with slice of pointers for some reason~~ fixed

If you are interested I can submit this component as a PR to https://github.com/charmbracelet/bubbles and continue to develop it over here.

Here are some examples: asciicast asciicast

erikgeiser avatar Nov 22 '20 13:11 erikgeiser

@muesli what do you think? Do you want a PR or are you working on your own implementation?

erikgeiser avatar Nov 28 '20 11:11 erikgeiser

Looking good! We love PRs :heart: and I think it makes sense to establish a few default components.

muesli avatar Nov 28 '20 13:11 muesli

@chriswalz I know this is quite an old issue but we've just introduced a new multi-line input in case you still wanted one 🙂

It's available on master https://github.com/charmbracelet/bubbles and there are some examples on how to use it here https://github.com/charmbracelet/bubbletea/pull/357

maaslalani avatar Jun 28 '22 17:06 maaslalani

Also a multiline answer. I would definitely see myself using them on https://github.com/chriswalz/bit.

Right now I'm using https://github.com/AlecAivazis/survey

Closing since the multi-line input is available with textarea! And, in terms of mult-select we have an implementation here: https://github.com/charmbracelet/gum/blob/main/choose/choose.go

maaslalani avatar Aug 18 '22 20:08 maaslalani