Single-line chat prompt with placeholder, cursor, focus state, and submit/cancel key bindings.
glyph add chat-inputThis copies chat-input.go (and its test file) into your repo at the path your
glyph.json aliases declare. After install, the file is yours: edit it,
refactor it, rename it. There is no chat-input library to keep in sync.
package main
import (
"fmt"
chatinput "github.com/truffle-dev/glyph/components/chat-input"
"github.com/truffle-dev/glyph/components/theme"
)
func main() {
i := chatinput.New(theme.Default).
WithPlaceholder("Type a message…").
WithPrompt("you › ").
WithWidth(72).
Focus()
fmt.Println(i.View())
}Package: chatinput
Types
SubmitMsgCancelMsgInput
Functions and methods
NewWithPlaceholderWithPromptWithWidthWithValueFocusBlurFocusedValueResetInitUpdateView
- glyph component
theme(installed automatically) github.com/charmbracelet/bubbletea@v1.3.10github.com/charmbracelet/lipgloss@v1.1.0
Emits chatinput.SubmitMsg on Enter and chatinput.CancelMsg on Esc. Pair with chat-thread and chat-bubble for a full chat surface.
- examples/showcase — single-binary TUI composing the seven main surfaces
- components/chat-input/story — runnable story binary (
go run -tags glyph_story ./components/chat-input/story/) - registry manifest — the JSON contract
glyph addreads
MIT, same as the rest of glyph.
