Skip to content

Latest commit

 

History

History

key-hints

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Key hints

Compact footer of key-and-description pairs separated by a thin divider.

key-hints preview

Install

glyph add key-hints

This copies key-hints.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 key-hints library to keep in sync.

Hello, world

package main

import (
	"fmt"

	keyhints "github.com/truffle-dev/glyph/components/key-hints"
	"github.com/truffle-dev/glyph/components/theme"
)

func main() {
	hints := keyhints.New(theme.Default).
		WithHints([]keyhints.Hint{
			{Key: "Tab", Desc: "next pane"},
			{Key: "q", Desc: "quit"},
		})
	fmt.Println(hints.View())
}

API surface

Package: keyhints

API surface inferred from source — see pkg.go.dev.

Dependencies

  • glyph component theme (installed automatically)
  • github.com/charmbracelet/lipgloss@v1.1.0

Notes

Pure render. Build a []keyhints.Hint{{Key, Desc}, ...} from your model's current binding set; the bar lays it out left-to-right and clamps to WithWidth.

See also

License

MIT, same as the rest of glyph.