Skip to main content
Version: 0.1.x

Try Ribir

You will learn

  • How to write and start a simple Hello world! application

Install Rust

At first, you need to install Rust, you can reference the official documentation.

Tips

Currently Ribir only supports Rust nightly channel. You can use rustup override set nightly to switch to nightly channel. If you haven't installed nightly channel yet, you can check out rustup Channels documentation.

Create a new Ribir project

Then, open your terminal and create a new Rust project:

cargo new ribir-hello-world
cd ribir-hello-world

Next, edit the Cargo.toml file and add Ribir as a dependency:

[dependencies]
ribir = "0.1.0-beta.7"

Or you can directly run cargo add --git "https://github.com/RibirX/Ribir" ribir to let Cargo add the latest Ribir version that is under development for you.

Start writing main.rs

Open your editor and modify the src/main.rs file to:

// main.rs
use ribir::prelude::*;

fn main() {
App::run(fn_widget! { @Text { text: "Hello World!" }});
}

Run the application

cargo run

Congratulations! You have completed your first Ribir project.

Run Ribir's built-in examples

Finally, there are some other examples in the Ribir repository, you can clone the Git repository:

git clone git@github.com:RibirX/Ribir.git
cd Ribir/Ribir

and run the examples with one of the following commands:

cargo run -p counter
cargo run -p storybook
cargo run -p messages
cargo run -p todos
cargo run -p worle_game