Skip to content

v0.14.0

Compare
Choose a tag to compare
@maaslalani maaslalani released this 06 Sep 16:34
· 155 commits to master since this release

Table Bubble

This feature release of Bubbles includes a brand new table bubble that you can use to show and select tabular data! Huge thanks to @wesleimp for contributing this change ❤️.

Table Bubble showing countries and their populations

See the example code for an example of how to use the table in your Bubble Tea applications.

Getting Started

Create a new table:

t := table.New(
	table.WithColumns(columns),
	table.WithRows(rows),
	table.WithFocused(true),
	table.WithHeight(7),
)

Alternatively,

t := table.New(table.WithColumns(columns))
t.SetRows(rows)
t.Focus()
t.SetHeight(7)

Style the table how you want:

s := table.DefaultStyles()
s.Header = s.Header.
	BorderStyle(lipgloss.NormalBorder()).
	BorderForeground(lipgloss.Color("240")).
	BorderBottom(true).
	Bold(false)
s.Selected = s.Selected.
	Foreground(lipgloss.Color("229")).
	Background(lipgloss.Color("57")).
	Bold(false)
t.SetStyles(s)

And then Update and Render (View) the table:

type model struct {
	table table.Model
}

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
	var cmd tea.Cmd
	m.table, cmd = m.table.Update(msg)
	return m, cmd
}

func (m model) View() string {
	return m.table.View()
}

Other Changes

  • Ctrl+H backspaces text by @maaslalani in #199
  • LineCount() + Include New Line characters in Length() by @maaslalani in #204
  • fix(viewport): honor width and height settings by @meowgorithm in #216
  • feat(textarea): new bindings for "go to begin" / "go to end" by @knz in #226
  • feat(textarea): PromptFunc, support dynamic prompts by @knz in #211
  • fix(viewport): properly truncate to size by @knz in #228

New Contributors

Full Changelog: v0.13.0...v0.14.0

Read more about it in our examples and docs:


The Charm logo

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