rayuiv0.1

Interfaces for handhelds, written in Rust.

rayui is the Gizlet launcher's look as a library for Rust and raylib. Describe screens declaratively; rayui lays them out, moves the focus with the D-pad and draws them, on a 640×480 handheld, a desktop window or right here in your browser.

● Gamepad first ● Mouse & touch ready ● One layout, every screen ● 中文 / 日本語
Loading the gallery…
←→↑↓ move Enter select Esc back QE tabs or click, or plug in a gamepad
◎

Focus that finds its way

Directions move the focus to the nearest element on screen, so grids, lists, sidebars and keyboards need no focus order.

▭

Logical units

The short side is always 720 units. A 640×480 handheld, a 4K monitor and a portrait panel all get the same layout at their own scale.

◐

Design tokens

Material-style color roles, type scale, shape, elevation, motion and density: switch the theme, brand color or touch density at run time.

❚❚

Quiet when still

Once input stops and animations settle, nothing is redrawn — it matters on software-rendered handhelds.

A whole app in one screen of code

Your state, a view that turns it into elements, and an update for the messages they send. The hint bar, focus ring, sounds and A/B swap come for free.

# Cargo.toml
[dependencies]
rayui = { git = "https://github.com/gizlet/rayui", tag = "v0.1.0" }
impl App for Counter {
    type Msg = Msg;

    fn view(&self) -> Element<Msg> {
        page("Counter")
            .body(column([
                text(self.n.to_string()).style(Type::Display),
                row([
                    button("-1").on_press(Msg::Add(-1)),
                    button("+1").on_press(Msg::Add(1)),
                ]).gap(16.0),
            ]).gap(24.0).center().fill())
            .into()
    }

    fn update(&mut self, msg: Msg, _: &mut Cx) {
        match msg { Msg::Add(d) => self.n += d }
    }
}