github charmbracelet/bubbles v0.9.0

latest releases: v2.0.0-alpha.1, v0.20.0, v0.19.0...
3 years ago

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

List Example

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

Help Example

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 error
  • Model.View(float64) string is now Model.View() string (to render a static view per the prior version use Model.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 the tea.Model interface making more composable

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.

The Charm logo

Don't miss a new bubbles release

NewReleases is sending notifications on new releases.