| Crates.io | dampen-cli |
| lib.rs | dampen-cli |
| version | 0.2.8 |
| created_at | 2026-01-09 15:54:57.002401+00 |
| updated_at | 2026-01-24 13:37:54.173819+00 |
| description | Developer CLI for Dampen UI framework |
| homepage | |
| repository | https://github.com/mattdef/dampen |
| max_upload_size | |
| id | 2032305 |
| size | 536,213 |
Declarative UI framework for Rust with Iced backend, hot reloading and advanced styling.
Dampen allows you to define your user interface in XML and render it via Iced.
⚠️ DEVELOPMENT STATUS
Dampen is currently under active development and is NOT ready for production use.
The framework is functional and can be tested for experimentation, learning, and contributing to its development. However, the API is unstable and subject to breaking changes. Features may be incomplete, and there may be bugs or performance issues.
Use Dampen for:
- ✅ Experimentation and learning
- ✅ Contributing to development
- ✅ Testing and providing feedback
- ✅ Prototype applications
Do NOT use Dampen for:
- ❌ Production applications
- ❌ Mission-critical systems
- ❌ Applications requiring API stability
We welcome your feedback and contributions! See CONTRIBUTING.md to get involved.
#[derive(UiModel)]cargo install dampen-cli
Use the CLI command to scaffold a new Dampen project:
# Create a new project
dampen new my-app
# Navigate to the project
cd my-app
# Run the application
dampen run
NEW! Quickly scaffold new UI windows with the dampen add command:
# Add a settings window
dampen add --ui settings
# Add a window in custom directory
dampen add --ui order_form --path "src/ui/orders"
This creates:
settings.rs - Model, handlers, and AppState setupsettings.dampen - Basic UI layout with data binding exampleThen add to src/ui/mod.rs:
pub mod settings;
Benefits:
See dampen add --help for more options.
# Validate XML syntax and widget names
dampen check
# Build the project
dampen build
# Inspect generated IR
dampen inspect src/ui/window.dampen
#[derive(UiModel, Default, Serialize, Deserialize, Clone)]
struct Model {
count: i32,
name: String,
items: Vec<TodoItem>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct TodoItem {
id: usize,
text: String,
completed: bool,
}
Define themes in src/ui/theme/theme.dampen for complete application theming:
<?xml version="1.0" encoding="UTF-8" ?>
<dampen version="1.0">
<themes>
<theme name="light">
<palette
primary="#3498db"
secondary="#2ecc71"
success="#27ae60"
warning="#f39c12"
danger="#e74c3c"
background="#ecf0f1"
surface="#ffffff"
text="#2c3e50"
text_secondary="#7f8c8d" />
<typography font_family="Inter, sans-serif" font_size_base="16" />
<spacing unit="8" />
</theme>
<theme name="dark" extends="light">
<palette
background="#1a1a2e"
surface="#16213e"
text="#eaeaea"
text_secondary="#a0a0a0" />
</theme>
</themes>
<default_theme name="light" />
<follow_system enabled="true" />
</dampen>
Runtime Theme Switching:
<button label="Dark Mode" on_click="set_theme('dark')" />
<button label="Light Mode" on_click="set_theme('light')" />
Theme Features:
extends="base_theme"<follow_system enabled="true" />theme.dampen and see changes instantly in developmentSee STYLING.md for complete documentation.
<styles>
<style name="btn_primary">
<base
background="#3498db"
color="#ffffff"
padding="8 16"
border_radius="6"
border_width="0" />
<hover background="#5dade2" />
<active background="#2874a6" />
<disabled opacity="0.5" />
</style>
<style name="btn_danger">
<base
background="#e74c3c"
color="#ffffff"
padding="8 16"
border_radius="6" />
<hover background="#ec7063" />
</style>
</styles>
<button class="btn_primary" label="Submit" on_click="submit" />
<button class="btn_danger" label="Delete" on_click="delete" />
| Widget | Description |
|---|---|
text |
Text display |
button |
Interactive button |
text_input |
Text input field |
checkbox |
Checkbox |
toggler |
Toggle switch |
pick_list |
Dropdown list |
radio |
Radio button |
column |
Vertical layout |
row |
Horizontal layout |
scrollable |
Scrollable area |
container |
Container |
for |
Dynamic loop |
grid |
Grid layout |
progress_bar |
Progress bar |
svg |
SVG image |
tooltip |
Tooltip |
Dampen supports two compilation modes optimized for different use cases:
Enabled by default in development builds
# Development mode (automatic)
dampen run
# Debug build (interpreted)
dampen build
Hot-reload example:
use dampen_dev::watch_files;
fn subscription(app: &App) -> Subscription<Message> {
watch_files(vec![PathBuf::from("src/ui/window.dampen")], "xml")
.map(|_| Message::ReloadUI)
}
Enabled with --release flag
# Release run (codegen)
dampen run --release
# Release build (codegen)
dampen build --release
# Alternative: release command (alias for build --release)
dampen release
How it works:
build.rs processes .dampen files at compile timeMode selection is automatic based on --release flag:
| CLI Command | Mode | Use Case |
|---|---|---|
dampen new |
- | Create new project |
dampen add |
- | Scaffold new UI window |
dampen run |
Interpreted | Development with hot-reload |
dampen run --release |
Codegen | Production testing |
dampen build |
Interpreted | Debug builds |
dampen build --release |
Codegen | Production builds (optimized) |
dampen release |
Codegen | Alias for build --release |
dampen test |
Interpreted | Fast test iteration |
dampen check |
- | Validate XML syntax |
Advanced usage:
# Enable additional features
dampen release --features tokio,logging
# Run tests in release mode
dampen test --release
# Verbose output
dampen build -v
Note: By default,
dampen runanddampen builduse interpreted mode for fast development. Use--releaseflag to enable codegen mode for production builds.
crates/
├── dampen-core/ # XML parser, IR, traits (no Iced dependency)
├── dampen-macros/ # Macros #[derive(UiModel)], #[dampen_ui]
├── dampen-iced/ # Iced backend implementation
├── dampen-dev/ # Development mode tooling for Dampen
└── dampen-cli/ # Developer CLI (build, check, inspect)
Declarative-First: XML is the source of truth for UI structure
Type Safety: No type erasure for messages/state
Production Mode: Static code generation for deployments
Backend-Agnostic: Core crate has no Iced dependency
Test-First: TDD for all features
See the examples/ directory for progressive demonstrations:
| Example | Features |
|---|---|
| hello-world | Minimal static UI rendering |
| counter | Interactive event handlers |
| todo-app | Complete data binding with lists |
| styling | Themes, classes, state styles |
| responsive | Responsive design with breakpoints |
| settings | Multiple views and navigation |
| widget-showcase | Demonstration of all widgets |
# Generate production code
dampen build --ui ui --output src/ui_generated.rs
# Validate UI files without running
dampen check --ui ui
# Inspect IR or generated code
dampen inspect --file ui/main.dampen
dampen inspect --file ui/main.dampen --codegen --handlers increment,decrement
We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or reporting issues, your help is appreciated.
Before contributing, please read our Contributing Guide which covers:
Quick start for contributors:
# Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/dampen.git
cd dampen
# Build and test
cargo build --workspace
cargo test --workspace
cargo clippy --workspace -- -D warnings
# Try the examples
dampen run -p hello-world
All contributions must:
cargo test --workspace)cargo clippy --workspace -- -D warnings)cargo fmt --all)See docs/CONTRIBUTING.md for complete details.
This project is dual-licensed under Apache 2.0 or MIT, at your option.
Built with ❤️ using Rust and Iced