molten_sparks

Crates.iomolten_sparks
lib.rsmolten_sparks
version0.1.0
created_at2025-12-14 18:45:40.424369+00
updated_at2025-12-14 18:45:40.424369+00
descriptionBeautiful TUI components for Cauldron 🎇
homepagehttps://molten.dev
repositoryhttps://github.com/moltenlabs/molten-sparks
max_upload_size
id1984923
size62,955
Chris Mathew (chriscmathew-dorsia)

documentation

https://docs.rs/molten_sparks

README

Sparks

🎇 Sparks

Beautiful TUI components for building terminal interfaces.

Crates.io Documentation CI License

ComponentsInstallationUsageEcosystem


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 sparks::{Spinner, SpinnerStyle};

let mut spinner = Spinner::new(SpinnerStyle::Dots)
    .title("Loading...");
    
// In your render loop
spinner.tick();
println!("{}", spinner.view());

📊 Progress

Beautiful progress bars.

use sparks::{Progress, ProgressStyle};

let bar = Progress::new()
    .progress(0.6)
    .width(40)
    .style(ProgressStyle::BLOCK)
    .show_percentage();
    
println!("{}", bar.view());
// ████████████████████████░░░░░░░░░░░░░░░░  60%

✏️ TextInput

Feature-rich text input fields.

use sparks::TextInput;

let mut input = TextInput::new()
    .placeholder("Enter your name...")
    .char_limit(50);
    
input.insert('H');
input.insert('i');
println!("{}", input.view());

📋 List

Scrollable selection lists.

use sparks::List;

let mut list = List::new([
    "Option A",
    "Option B", 
    "Option C",
]).height(5);

list.down(); // Move selection
println!("{}", list.view());

📜 Viewport

Scrollable content areas.

use sparks::Viewport;

let mut viewport = Viewport::new(80, 24);
viewport.set_content(long_text);

viewport.scroll_down(5);
viewport.page_down();
println!("{}", viewport.view());

📑 Table

Data tables with selection.

use sparks::{Table, TableColumn};

let table = Table::new([
    TableColumn::new("Name"),
    TableColumn::new("Age"),
])
.row(["Alice", "30"])
.row(["Bob", "25"])
.selectable();

println!("{}", table.view());

🗂️ Tabs

Tab navigation component.

use sparks::Tabs;

let mut tabs = Tabs::new(["Home", "Settings", "Help"]);
tabs.next(); // Switch tabs
println!("{}", tabs.view());
// Home | **Settings** | Help

Installation

cargo add sparks

Or add to your Cargo.toml:

[dependencies]
sparks = "0.1"

Spinner Styles

use sparks::SpinnerStyle;

SpinnerStyle::Dots      // ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏
SpinnerStyle::Line      // | / - \
SpinnerStyle::Arrow     // ← ↖ ↑ ↗ → ↘ ↓ ↙
SpinnerStyle::Circle    // ◐ ◓ ◑ ◒
SpinnerStyle::Moon      // 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘
SpinnerStyle::Fire      // 🔥 🔥 ✨ 🔥

Progress Styles

use sparks::ProgressStyle;

ProgressStyle::BLOCK    // ████████░░░░
ProgressStyle::CLASSIC  // [========---]
ProgressStyle::THIN     // ━━━━━━━━────
ProgressStyle::CIRCLE   // ●●●●●●○○○○○○

With Cauldron

Sparks components work seamlessly with the Cauldron TUI framework:

use cauldron::{Model, Command};
use sparks::{Spinner, SpinnerStyle};

struct LoadingApp {
    spinner: Spinner,
}

impl Model for LoadingApp {
    type Message = ();

    fn update(&mut self, _: ()) -> Command<()> {
        self.spinner.tick();
        Command::none()
    }

    fn view(&self) -> String {
        self.spinner.view()
    }
}

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:

at your option.


Built with 🎇 by Molten Labs

Commit count: 0

cargo fmt