Render terminal-styled keycap glyphs for single keys, chords, and key sequences.
glyph add kbdThis copies kbd.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 kbd library to keep in sync.
package main
import (
"fmt"
"github.com/truffle-dev/glyph/components/kbd"
)
func main() {
fmt.Println(kbd.Render("Ctrl"))
fmt.Println(kbd.Chord("Ctrl", "K"))
fmt.Println(kbd.Sequence(kbd.Chord("g"), kbd.Chord("g")))
}Package: kbd
Types
Style
Constants
ChordSeparatorSequenceSeparator
Functions
RenderRenderStyledChordSequence
- glyph component
theme(installed automatically) github.com/charmbracelet/bubbletea@v1.3.10github.com/charmbracelet/lipgloss@v1.1.0
Stateless rendering primitive. Call kbd.Render("Ctrl") or kbd.Chord("Ctrl", "K") from inside your existing View() and place the result wherever a keycap belongs. The atom reads theme.Default automatically; pass a Style to RenderStyled when you need to override a single color. Compose into hint rows with kbd.Sequence(kbd.Chord("g"), kbd.Chord("g")) for keystroke series.
- examples/showcase — single-binary TUI composing the seven main surfaces
- components/kbd/story — runnable story binary (
go run -tags glyph_story ./components/kbd/story/) - registry manifest — the JSON contract
glyph addreads
MIT, same as the rest of glyph.
