#ambient #ui #element #react #hook #top #built

ambient_ui

A UI library for the Ambient runtime, built on top of Ambient's Element library

16 releases

0.3.1 Oct 25, 2023
0.3.1-rc.1 Oct 24, 2023
0.3.0-rc.2 Sep 29, 2023
0.2.1 May 6, 2023

#12 in #ambient

Download history 29/week @ 2024-02-12 64/week @ 2024-02-19 66/week @ 2024-02-26 42/week @ 2024-03-04 58/week @ 2024-03-11 65/week @ 2024-03-18 83/week @ 2024-03-25 95/week @ 2024-04-01 36/week @ 2024-04-08 44/week @ 2024-04-15 69/week @ 2024-04-22 48/week @ 2024-04-29 36/week @ 2024-05-06 41/week @ 2024-05-13 50/week @ 2024-05-20 21/week @ 2024-05-27

156 downloads per month
Used in 15 crates (2 directly)

MIT/Apache

365KB
9K SLoC

ambient_ui

A UI library for Ambient. Built on top of ambient_element.

Ambient's UI system is heavily inspired by React (with hooks), and follows many of the same patterns. Take a look at the React documentation to learn how hooks work in general.


lib.rs:

A UI library for Ambient. Built on top of ambient_element.

Ambient's UI system is heavily inspired by React (with hooks), and follows many of the same patterns. Take a look at the React documentation to learn how hooks work in general.

Getting started

Here's a minimal, complete example of a counter app:

use ambient_api::prelude::*;

#[element_component]
fn App(hooks: &mut Hooks) -> Element {
    let (count, set_count) = use_state(hooks,0);
    FlowColumn::el([
        Text::el(format!("We've counted to {count} now")),
        Button::new("Increase", move |_| set_count(count + 1)).el(),
    ])
}

#[main]
pub fn main() {
    App.el().spawn_interactive();
}

See all UI examples here.

Dependencies

~10–56MB
~1M SLoC