Expand description
§boxy-cli
A Rust library for creating beautifully styled, multi-segment text boxes in terminal applications — with full Unicode border support, true-color text, word-wrapping, columnar layouts, and automatic terminal-width awareness.
§Features
- 9 border styles — classic ASCII, single, double, bold, rounded, and more
- True-color support — hex color codes for both borders and per-line text
- Multi-segment boxes — stack multiple sections separated by smart dividers
- Columnar layouts — side-by-side columns inside a single box, with per-segment
ratio control and correct
┼/┬/┴junction characters where column boundaries meet - Word wrapping — automatic wrapping to terminal width with internal padding awareness
- Text alignment — left, center, or right per segment
- Terminal-aware sizing — auto-sizes to terminal width, or use a fixed width
- Two APIs — imperative (
Boxy) and fluent builder (BoxyBuilder) - Macro support —
boxy!for quick one-liner (Work in Progress)
§Known Limitations
Unicode wide characters — characters that occupy two terminal columns (CJK glyphs, most emoji) are measured as one column internally. Text containing these characters will appear narrower than expected and centering/alignment will be off. Full wide-character support is planned for a future release.
§Quick Start
use boxy_cli::prelude::*;
// Fluent builder API
Boxy::builder()
.box_type(BoxType::Double)
.color("#00ffff")
.add_segment("Hello, boxy-cli!", "#ffffff", BoxAlign::Center)
.add_segment("A terminal box library for Rust", "#32CD32", BoxAlign::Center)
.padding(BoxPad::uniform(1), BoxPad::vh(1, 2))
.build()
.display();§Columnar Layout
Columnar segments let you place content side-by-side inside one box. Column widths are
controlled by ratio values — vec![1, 2, 1] gives the middle column twice the space.
use boxy_cli::prelude::*;
let mut b = Boxy::new(BoxType::Single, "#00ffff");
b.add_text_sgmt("Project Status", "#ffffff", BoxAlign::Center);
b.add_col_text_sgmt(BoxAlign::Left, 3);
b.add_col_text_line("Name", "#aaaaaa", &0usize);
b.add_col_text_line("Status", "#aaaaaa", &1usize);
b.add_col_text_line("Notes", "#aaaaaa", &2usize);
b.add_col_text_line("Lumio V2", "#ffffff", &0usize);
b.add_col_text_line("Shipped", "#32CD32", &1usize);
b.add_col_text_line("Internship project", "#ffffff", &2usize);
b.set_segment_ratios(1, vec![1, 1, 2]);
b.display();§Further Reading
Boxy— imperative API referenceBoxyBuilder— builder API referenceBoxType— all available border stylesboxy!— macro reference- GitHub README — more examples and screenshots
Re-exports§
pub use prelude::*;
Modules§
Macros§
- boxy
- Macro for creating a new Boxy struct