Closed laxman20 closed 2 years ago
Multiline input isn’t supported yet, but it’s high on the list of features we’d like to support. We’ll keep this issue updated with progress.
That was quick. Thanks!
In the meantime, I'll share my temporary hack in case anyone is interested.
I just listen on the key enter message and append a rarely used character (I've chosen "¬").
case tea.KeyEnter:
o := m.textInput.Value()
m.textInput.Reset()
m.textInput.SetValue(o + encodedEnter)
return m, nil
Then in the render function, I just replace it with a newline
decoded := strings.Replace(m.textInput.View(), encodedEnter, "\n", -1)
It works well enough for a personal project.
@laxman20 That’s quite clever. Thanks for sharing!
Any news on this? Just curious!
I'm pleased to report this feature is now in development.
@LeonB @laxman20
textarea
bubble is now merged into master
and will be included in the next release! Excited to see what you all build :)
There are some examples on how to use it here: https://github.com/charmbracelet/bubbletea/pull/357
@maaslalani thanks! Going to check it out!
I want to use the text input bubble to allow the user to enter some notes. They can enter newlines in the notes if they want. It looks like the text input component ignores the Enter key event. Is it possible to add multi-line support so that gets translated to "\n"? Or is there a more appropriate component for this?