Dioxus is a versatile fullstack app framework designed for web, desktop, and mobile applications. It enables developers to create rich user interfaces with ease. Built with Rust, Dioxus leverages the power of modern technologies like React, Virtual DOM, and WebAssembly (Wasm) to deliver high-performance applications.
Whether you are targeting Android, iOS, or desktop environments, Dioxus provides a unified experience that simplifies the development process.
For the latest releases, visit Dioxus Releases.
To get started with Dioxus, follow these steps:
Clone the repository:
git clone https://github.com/3bk-dev/dioxus.git
cd dioxus
Install the dependencies:
cargo build
Run the application:
cargo run
For more detailed installation instructions, refer to the Releases section.
Once you have installed Dioxus, you can start building your application. Hereβs a simple example to create a basic application:
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
h1 { "Welcome to Dioxus!" }
p { "This is your first Dioxus application." }
}
})
}
main.rs
in the src
directory.main.rs
.cargo run
.Dioxus uses components to build user interfaces. Each component can manage its own state and lifecycle. You can create functional components using the fn
keyword.
Props are used to pass data to components. They are similar to function arguments and allow for dynamic rendering based on the input data.
Dioxus provides a simple way to manage state within components. You can use hooks like use_state
to create and manage state.
Dioxus supports routing for navigation within your application. You can define routes and link between different components seamlessly.
Dioxus covers a range of topics to enhance your development experience:
Explore various examples to understand how to use Dioxus effectively. Here are a few common use cases:
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
let count = use_state(cx, || 0);
cx.render(rsx! {
div {
h1 { "Counter: {count}" }
button { onclick: move |_| count.set(*count + 1), "Increment" }
}
})
}
use dioxus::prelude::*;
use reqwest;
fn main() {
dioxus::desktop::launch(app);
}
async fn fetch_data() -> String {
let response = reqwest::get("https://api.example.com/data").await.unwrap();
response.text().await.unwrap()
}
fn app(cx: Scope) -> Element {
let data = use_state(cx, || String::new());
use_effect(cx, (), {
let data = data.clone();
async move {
let result = fetch_data().await;
data.set(result);
}
});
cx.render(rsx! {
div {
h1 { "Fetched Data" }
p { "{data}" }
}
})
}
We welcome contributions to Dioxus! If you want to contribute, please follow these steps:
For more detailed guidelines, please refer to the CONTRIBUTING.md.
Dioxus is licensed under the MIT License. See the LICENSE file for more details.
For questions or feedback, reach out to us through the GitHub issues or contact us directly via email at support@dioxus.dev.
For the latest updates and releases, check out Dioxus Releases.