🌸 Iris UI

Pure Rust UI Framework

Philosophy

The UI is a projection of a virtual world onto the screen.

Iris UI embraces a unique approach to building user interfaces: instead of thinking about widgets and layouts, you model your application as a virtual world. The UI becomes a natural projection of this world onto the screen.

About Iris UI

Iris UI is a pure Rust UI framework that lets you build interfaces by modeling virtual worlds. Using Rust's type system and ergonomic syntax, you can create rich, interactive applications with a declarative approach.

Examples

Clock Example

A simple clock that updates the time every few milliseconds, demonstrating the World, Board, Card, Row, Text, and TextTimer components.

//! A simple little clock that updates the time every few milliseconds.

use iris_ui::prelude::*;

fn world() -> World {
    World {
        root: Board {
            width: VIEWPORT_WIDTH,
            height: VIEWPORT_HEIGHT,
            h_align: HAlign::Center,
            v_align: VAlign::Middle,
            children: vec![Card {
                children: vec![
                    Row {
                        children: vec![Text{
                            text: "Carpe diem 🎉",
                            ..default()
                        }.into()],
                        ..default()
                    },
                    Row {
                        children: vec![TextTimer{
                            format: "%H:%M:%S",
                            ..default()
                        }.into()],
                        ..default()
                    },
                ],
                ..default()
            }],
            ..default()
        }.into(),
    }
}

fn main() {
    iris_ui::launch(world);
}

Lovely Girl Example

A minimal example demonstrating how to create custom widgets and model domain-specific virtual worlds.

//! A minimal example for `iris-ui` demonstrating basic usage.

use iris_ui::prelude::*;

#[derive(IntoWidget)]
struct LovelyGirl {
    girl: Girl,
}

fn lovely_girl() -> LovelyGirl {
    LovelyGirl {
            girl: Girl {
                hair_color: HairColor::Black,
                skin_color: SkinColor::Yellow,
                body_type: BodyType::Slim,
                appearance: Appearance::Beautiful,
                every_morning: vec![
                    GirlActions::SayHi,
                    GirlActions::PrepareBreakfast,
                ],
                ..default()
            },
    }
}

fn world() -> World {
    World {
        root: lovely_girl().into(),
        ..default()
    }
}

fn main() {
    iris_ui::launch(world);
}

Getting Started

To run the examples:

cargo run --example clock
cargo run --example lovely_girl