inputfields.go 521 B

1234567891011121314151617181920
  1. package ui
  2. import (
  3. "github.com/gdamore/tcell/v2"
  4. "github.com/rivo/tview"
  5. )
  6. func NewMessageInputField(onMessageInputFieldDone func(key tcell.Key)) (messageInputField *tview.InputField) {
  7. messageInputField = tview.NewInputField().
  8. SetPlaceholder("Message...").
  9. SetFieldWidth(0).
  10. SetDoneFunc(onMessageInputFieldDone)
  11. messageInputField.
  12. SetFieldBackgroundColor(tview.Styles.PrimitiveBackgroundColor).
  13. SetPlaceholderTextColor(tcell.ColorDarkGray).
  14. SetBorder(true).
  15. SetBorderPadding(0, 0, 1, 1)
  16. return
  17. }