Installation
Add bloom to a Go module, and the versions of Go, Bubble Tea, and Lip Gloss it works with.
Requirements
- Go 1.27 or newer. bloom uses generic methods, such as
frame.Rect[K], which need it. - Bubble Tea v2, imported as
charm.land/bubbletea/v2. - Lip Gloss v2, imported as
charm.land/lipgloss/v2, for styling text and boxes.
bloom isn't built for Bubble Tea v1. Its views are tea.View values, and its mouse routing uses the OnMouse
handler that v2 views have.
Install
go get github.com/lrstanley/bloom@latestThat gets all of bloom's packages. Import the ones you use:
import (
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
"github.com/lrstanley/bloom"
"github.com/lrstanley/bloom/anim" // animated values, for transitions
"github.com/lrstanley/bloom/fx" // effects, for transitions and backdrops
)Expect breaking changes
bloom is pre-1.0, and its API may still change significantly before v1.0.0. Pin the version in your
go.mod and read the release notes before upgrading.
Check that it works
This program prints a two-column layout and exits. It uses bloom.Render, which turns a layout into a string
without running a Bubble Tea program, so it's an easy way to try layouts out.
package main
import (
"fmt"
"charm.land/lipgloss/v2"
"github.com/lrstanley/bloom"
)
func main() {
box := lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).Padding(0, 1)
fmt.Println(bloom.Render(bloom.Row(
bloom.Fixed(16, bloom.Box(box, bloom.Text("sidebar"))),
bloom.Fill(bloom.Box(box, bloom.Text("content"))),
), 50, 5))
}$ go run .
╭──────────────╮╭────────────────────────────────╮
│ sidebar ││ content │
│ ││ │
│ ││ │
╰──────────────╯╰────────────────────────────────╯Next, build your first layout in a real Bubble Tea program.
Last updated on