Cross-platform UI framework in Rust with
- Easy functional composasbles
- Flexible state management
- Desktop and mobile support
- Accessibility
- Native skia rendering
Hello World
use concoct::{composable::text, render::run, Modifier};
fn app() {
text(Modifier::default(), "Hello World!")
}
fn main() {
run(app)
}
Creating a composable
To create your own composable, write a function using Rust's #[track_caller]
attribute macro.
#[track_caller]
fn title_text(title: String) {
text(Modifier::default().font_size(80.dp()), title);
}
State
State is created with the state
composable.
let mut tester = Tester::new(|| {
container(Modifier::default(), || {
let count = state(|| 0);
text(Modifier::default(), count.get().cloned().to_string());
*count.get().as_mut() += 1;
})
});
for count in 0..5 {
assert!(tester.get_text(count.to_string()).is_some());
}