What is Sparks?
Sparks is the Rust equivalent of bubbles from Charmbracelet. It provides beautiful, ready-to-use TUI components that work standalone or with the Cauldron framework.
Components
🔄 Spinner
Animated loading indicators with multiple styles.
use ;
let mut spinner = new
.title;
// In your render loop
spinner.tick;
println!;
📊 Progress
Beautiful progress bars.
use ;
let bar = new
.progress
.width
.style
.show_percentage;
println!;
// ████████████████████████░░░░░░░░░░░░░░░░ 60%
✏️ TextInput
Feature-rich text input fields.
use TextInput;
let mut input = new
.placeholder
.char_limit;
input.insert;
input.insert;
println!;
📋 List
Scrollable selection lists.
use List;
let mut list = new.height;
list.down; // Move selection
println!;
📜 Viewport
Scrollable content areas.
use Viewport;
let mut viewport = new;
viewport.set_content;
viewport.scroll_down;
viewport.page_down;
println!;
📑 Table
Data tables with selection.
use ;
let table = new
.row
.row
.selectable;
println!;
🗂️ Tabs
Tab navigation component.
use Tabs;
let mut tabs = new;
tabs.next; // Switch tabs
println!;
// Home | **Settings** | Help
Installation
Or add to your Cargo.toml:
[]
= "0.1"
Spinner Styles
use SpinnerStyle;
Dots // ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏
Line // | / - \
Arrow // ← ↖ ↑ ↗ → ↘ ↓ ↙
Circle // ◐ ◓ ◑ ◒
Moon // 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘
Fire // 🔥 🔥 ✨ 🔥
Progress Styles
use ProgressStyle;
BLOCK // ████████░░░░
CLASSIC // [========---]
THIN // ━━━━━━━━────
CIRCLE // ●●●●●●○○○○○○
With Cauldron
Sparks components work seamlessly with the Cauldron TUI framework:
use ;
use ;
Ecosystem
Sparks is part of the Molten Labs open source ecosystem:
| Crate | Description |
|---|---|
| molten_brand | Design tokens & colors |
| glyphs | ANSI escape sequences |
| lacquer | Terminal styling |
| cauldron | TUI framework |
| sparks | TUI components (you are here) |
| rune | Shell glamour |
| ember | Markdown renderer |
| smelt | Pretty logging |
Why "Sparks"?
Like sparks flying from the forge, these components are the bright, energetic building blocks that bring your terminal interfaces to life. 🎇
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.