Two-button yes/no prompt with focus-managed buttons, y/n shortcuts, dangerous-action styling, and prompt reflow.
glyph add confirmationThis copies confirmation.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 confirmation library to keep in sync.
package main
import (
"fmt"
"github.com/truffle-dev/glyph/components/confirmation"
"github.com/truffle-dev/glyph/components/theme"
)
func main() {
c := confirmation.New(theme.Default).
WithPrompt("Delete this conversation?").
WithYesLabel("Delete").
WithDangerous(true).
WithWidth(48)
fmt.Println(c.View())
}Package: confirmation
Types
ConfirmMsgCancelMsgConfirm
Functions and methods
NewWithPromptWithYesLabelWithNoLabelWithDefaultWithDangerousWithWidthFocusedYesInitUpdateView
- glyph component
theme(installed automatically) github.com/charmbracelet/bubbletea@v1.3.10github.com/charmbracelet/lipgloss@v1.1.0github.com/muesli/reflow@v0.3.0
Tab/Left/Right walk between Yes and No; y/Y and n/N commit with one keystroke regardless of focus; Enter commits the focused button. Emits confirmation.ConfirmMsg{Value bool} on commit, confirmation.CancelMsg on Esc. Set WithDangerous(true) to style Yes with theme.Error for destructive actions.
- examples/showcase — single-binary TUI composing the seven main surfaces
- components/confirmation/story — runnable story binary (
go run -tags glyph_story ./components/confirmation/story/) - registry manifest — the JSON contract
glyph addreads
MIT, same as the rest of glyph.
