What is Cauldron?
Cauldron is the Rust equivalent of bubbletea from Charmbracelet. It provides a simple, functional approach to building terminal user interfaces using The Elm Architecture.
use ;
Features
๐๏ธ Elm Architecture
- Model - Your application state
- Message - Events that update state
- Update - Pure state transitions
- View - Render to terminal
โก Simple API
๐ฑ๏ธ Input Handling
- Keyboard events
- Mouse support (optional)
- Bracketed paste mode
- Focus events
๐จ Styling Integration
use ;
Installation
Or add to your Cargo.toml:
[]
= "0.1"
Quick Start
1. Define Your Model
2. Define Your Messages
3. Implement the Model Trait
use ;
4. Run It
The Elm Architecture
Cauldron follows The Elm Architecture (TEA), a pattern for building interactive programs:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโ โ
โ โ Event โโโโโถโ Update โโโโโถโ Model โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโฌโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโ โ
โ โ View โ โ
โ โโโโโโฌโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโ โ
โ โ Terminalโ โ
โ โโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Events come from user input (keyboard, mouse)
- Update transforms events into state changes
- Model holds your application state
- View renders the model to a string
- Terminal displays the view
Commands
Commands let you perform side effects:
// Do nothing
none
// Quit the application
quit
// Send a message
message
// Batch multiple commands
batch
// Async task (coming soon)
perform
App Builder
Use the App builder for more control:
use App;
new
.with_mouse // Enable mouse support
.inline // Don't use alternate screen
.show_cursor // Keep cursor visible
.with_bracketed_paste // Enable bracketed paste
.run
.unwrap;
Ecosystem
Cauldron is part of the Molten Labs open source ecosystem:
| Crate | Description | Status |
|---|---|---|
| molten_brand | Design tokens & colors | โ Published |
| glyphs | ANSI escape sequences | โ Published |
| lacquer | Terminal styling | โ Published |
| cauldron | TUI framework (you are here) | โ Published |
| sparks | TUI components | ๐ง Coming Soon |
| rune | Shell glamour | ๐ง Coming Soon |
Why "Cauldron"?
In the forge, a cauldron is where raw materials are melted and transformed into something new. Cauldron transforms your application state through pure functions, bubbling up beautiful terminal interfaces. ๐ฎ
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.