bubbletea-widgets
Rust components for building TUIs with bubbletea-rs, ported from Charmbracelet's Go
bubbles. This is a Rust implementation of
the original Go code. All credit for the original designs and APIs goes to the
Charm team and Go community.
Installation
Add bubbletea-widgets to your Cargo.toml dependencies. You will also need bubbletea-rs and lipgloss-extras for a complete TUI application.
[]
= "0.0.7"
= "0.1.11"
= { = "0.0.8", = ["full"] }
Note: This repository is named
bubbles-rsfor historical reasons, but the package name on crates.io isbubbletea-widgets. The originalbubbles-rsname was already taken by another TUI framework. Always usebubbletea-widgetswhen adding this crate to your dependencies.
Components
Spinner
A spinner for indicating an operation is in progress. Includes multiple presets and option-style configuration.
use ;
use ;
let sp = new;
let frame = sp.view;
Text Input
Single-line input akin to HTML’s <input type="text">. Supports unicode, pasting,
in-place scrolling, and customizable key bindings.
use new;
let mut input = new;
input.set_placeholder;
input.set_width;
let _ = input.focus;
Text Area
Multi-line text input akin to <textarea>. Supports unicode, soft-wrapping,
vertical scrolling, and rich styling via Lip Gloss.
use textarea;
let mut ta = new;
ta.set_width;
ta.set_height;
ta.insert_string;
let view = ta.view;
Table
Scrollable, navigable tables with headers, selection, and styling.
use ;
let columns = vec!;
let rows = vec!;
let table = new.with_rows;
let _out = table.view;
Progress
Simple, customizable progress meter with optional animation and gradients.
use ;
let mut p = new;
let _cmd = p.set_percent;
let out = p.view;
Paginator
Pagination logic and rendering for dot-style or numeric pagination.
use Model;
let mut p = new;
p.set_per_page;
p.set_total_items;
let view = p.view; // e.g., "1/10" or dots depending on type
Viewport
Vertically scrollable viewport for large content; supports key bindings and horizontal scrolling.
use viewport;
let mut vp = new;
vp.set_content;
let visible = vp.visible_lines;
List
Customizable, batteries-included list with pagination, fuzzy filtering, spinner, status messages, and auto-generated help.
use ;
;
let items = vec!;
let list = new;
let _out = list.view;
File Picker
Navigate directories and select files with keyboard navigation and customizable styles.
use Model;
let = init;
let _out = picker.view;
Timer
Countdown timer with configurable interval and start/stop/toggle commands.
use new;
use Duration;
let timer = new;
let cmd = timer.init; // schedule ticks
let view = timer.view;
Stopwatch
Count-up timer with start/stop/toggle and reset.
use new;
let sw = new;
let start_cmd = sw.start;
Help
Horizontal mini help view that auto-generates from your key bindings; supports single and multi-line modes and truncates gracefully.
// Help is integrated into components via a KeyMap trait and `help::Model`.
// See `help.rs` and component-specific `KeyMap` implementations.
Key
Non-visual key binding management with help text generation and matching utilities.
use ;
use KeyMsg;
use ;
let save = new_binding;
let quit = new_binding;
let msg = KeyMsg ;
let matched = matches;
There’s more where that came from
Community-maintained Bubbles are listed by Charm & Friends: additional bubbles.
Contributing
Issues and PRs welcome. This project aims to mirror the Go API where it makes sense in Rust, and to keep the codebase clean and idiomatic.
Attribution
- Original Go project:
charmbracelet/bubbles - TUI framework inspiration:
charmbracelet/bubbletea
This crate is a Rust implementation/port. Design, API concepts, and many behaviors are derived from the Go implementation by Charmbracelet and contributors.
Examples
Check out the interactive examples in the examples/ directory:
# Run the main list example
# Run debug versions for testing filter highlighting
The examples demonstrate the list component with filtering functionality and can be used to test the filter highlighting features.
License
MIT. See LICENSE.