Lists, Animated Progress Bar and More
There are a handful of new things in this release, the biggest being the brand new List Bubble we extrapolated from Glow. Read on!
New: List
The List Bubble is a highly customizable, batteries-included component for browsing a set of items. It features pagination, fuzzy filtering, auto-generated help, an activity spinner, and status messages, all of which can be enabled and disabled as needed.
New: Key
A non-visual component for managing keybindings. It’s useful for allowing users to remap keybindings, allows keys to be enabled and disabled programatically, and can be used to generate help views.
import "github.com/charmbracelet/bubbles/key"
up := key.NewBinding(
key.WithKeys("up", "k"),
key.WithHelp("↑/k", "move up"),
)
if key.Matches(msg, up) {
// ...
}
New: Help
A customizable horizontal mini help view that automatically generates itself from your keybindings. It features single and multi-line modes, which the user can optionally toggle between. It will truncate gracefully if the terminal is too wide for the content.
Updated: Progress Bar
The progress bar has been updated so that it can now animate itself via Harmonica. You can, of course, still render non-animated progress bars too.
Note that there are also some minor API changes to the Progress Bubble. See the changelog below.
Progress Bar Changelog
Changed
NewModel
no longer returns an errorModel.View(float64) string
is nowModel.View() string
(to render a static view per the prior version useModel.ViewAs(float64) string
)- Invalid hex colors now render as black
New
- Added
WithSpringOptions
to customize spring animation - Added
Model.Update
for animating the progress bar - Added
Model.ViewAs(float64) string
for rendering static progress bars Model
now satisfies thetea.Model
interface making more composable
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.