Home

Awesome

<p> <p align="center" > <img src="./notes/header-light.svg#gh-light-mode-only" > <img src="./notes/header-dark.svg#gh-dark-mode-only" > <a href="https://dioxuslabs.com"> <img src="./notes/dioxus_splash_8.avif"> </a> </p> </p> <div align="center"> <!-- Crates version --> <a href="https://crates.io/crates/dioxus"> <img src="https://img.shields.io/crates/v/dioxus.svg?style=flat-square" alt="Crates.io version" /> </a> <!-- Downloads --> <a href="https://crates.io/crates/dioxus"> <img src="https://img.shields.io/crates/d/dioxus.svg?style=flat-square" alt="Download" /> </a> <!-- docs --> <a href="https://docs.rs/dioxus"> <img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square" alt="docs.rs docs" /> </a> <!-- CI --> <a href="https://github.com/jkelleyrtp/dioxus/actions"> <img src="https://github.com/dioxuslabs/dioxus/actions/workflows/main.yml/badge.svg" alt="CI status" /> </a> <!--Awesome --> <a href="https://dioxuslabs.com/awesome"> <img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome Page" /> </a> <!-- Discord --> <a href="https://discord.gg/XgGxMSkvUM"> <img src="https://img.shields.io/discord/899851952891002890.svg?logo=discord&style=flat-square" alt="Discord Link" /> </a> </div> <div align="center"> <h3> <a href="https://dioxuslabs.com"> Website </a> <span> | </span> <a href="https://github.com/DioxusLabs/dioxus/tree/main/examples"> Examples </a> <span> | </span> <a href="https://dioxuslabs.com/learn/0.5/guide"> Guide </a> <span> | </span> <a href="https://github.com/DioxusLabs/dioxus/blob/main/translations/zh-cn/README.md"> 中文 </a> <span> | </span> <a href="https://github.com/DioxusLabs/dioxus/blob/main/translations/pt-br/README.md"> PT-BR </a> <span> | </span> <a href="https://github.com/DioxusLabs/dioxus/blob/main/translations/ja-jp/README.md"> 日本語 </a> <span> | </span> <a href="https://github.com/DioxusLabs/dioxus/blob/main/translations/tr-tr"> Türkçe </a> <span> | </span> <a href="https://github.com/DioxusLabs/dioxus/blob/main/translations/ko-kr"> 한국어 </a> </h3> </div> <br> <br>

Build for web, desktop, and mobile, and more with a single codebase. Zero-config setup, integrated hotreloading, and signals-based state management. Add backend functionality with Server Functions and bundle with our CLI.

fn app() -> Element {
    let mut count = use_signal(|| 0);

    rsx! {
        h1 { "High-Five counter: {count}" }
        button { onclick: move |_| count += 1, "Up high!" }
        button { onclick: move |_| count -= 1, "Down low!" }
    }
}

⭐️ Unique features:

Instant hot-reloading

With one command, dx serve and your app is running. Edit your markup and styles and see the results in real time. Rust code hotreloading is not yet 1st class, but possible with hot-lib-reloader.

<div align="center"> <img src="./notes/hotreload.gif"> </div>

Bundler for deploying to the web and desktop

Simply run dx bundle and your app will be built and bundled with maximization optimizations. On the web, take advantage of .avif generation, .wasm compression, minification, and more. Build webapps weighing less than 50kb and desktop/mobile apps less than 15mb.

<div align="center"> <img src="./notes/bundle.gif"> </div>

Fantastic documentation

We've put a ton of effort into building clean, readable, and comprehensive documentation. All html elements and listeners are documented with MDN docs, and our docsite runs continuous integration with Dioxus itself to ensure that the docs are always up to date. Check out the Dioxus website for guides, references, recipes, and more. Fun fact: we use the Dioxus website as a testbed for new diouxs features - check it out!

<div align="center"> <img src="./notes/docs.avif"> </div>

Emphasis on developer experience

Dioxus prioritizes developer experience, and we've put a ton of effort into end-to-end tooling. We've built a VSCode extension that autoformats your RSX code, converts HTML to RSX, and more. We've also built a very powerful CLI that supports creating new apps, serving them, and cross-platform bundling, with deployment on the roadmap.

<div align="center"> <img src="./notes/autofmt.gif"> </div>

Community

Dioxus is a community-driven project, with a very active Discord and GitHub community. We're always looking for help, and we're happy to answer questions and help you get started. Our SDK is community-run and we even have a GitHub organization for the best Dioxus crates that receive free upgrades and support.

<div align="center"> <img src="./notes/dioxus-community.avif"> </div>

Full-time core team

Dioxus has grown from a side project to a small team of fulltime engineers. Thanks to the generous support of FutureWei, Satellite.im, the GitHub Accelerator program, we're able to work on Dioxus full-time. Our long term goal is for Dioxus to become self-sustaining by providing paid high-quality enterprise tools. If your company is interested in adopting Dioxus and would like to work with us, please reach out!

Supported Platforms

<div align="center"> <table style="width:100%"> <tr> <td> <b>Web</b> <br /> <em>Tier 1 Support</em> </td> <td> <ul> <li>Render directly to the DOM using WebAssembly</li> <li>Pre-render with SSR and rehydrate on the client</li> <li>Simple "hello world" at about 50kb, comparable to React</li> <li>Built-in dev server and hot reloading for quick iteration</li> </ul> </td> </tr> <tr> <td> <b>Fullstack</b> <br /> <em>Tier 1 Support</em> </td> <td> <ul> <li>Suspense, hydration, and server-side rendering</li> <li>Quickly drop in backend functionality with server functions</li> <li>Extractors, middleware, and routing integrations</li> <li>Compatible with desktop and mobile!</li> </ul> </td> </tr> <tr> <td> <b>Desktop</b> <br /> <em>Tier 1 Support</em> </td> <td> <ul> <li>Render using Webview or - experimentally - with WGPU or <a href="https://freyaui.dev">Freya</a> (skia) </li> <li>Zero-config setup. Simply `cargo run` or `dx serve` to build your app </li> <li>Full support for native system access without IPC </li> <li>Supports macOS, Linux, and Windows. Portable <3mb binaries </li> </ul> </td> </tr> <tr> <td> <b>Liveview</b> <br /> <em>Tier 1 Support</em> </td> <td> <ul> <li>Render apps - or just a single component - entirely on the server</li> <li>Integrations with popular Rust frameworks like Axum and Warp</li> <li>Extremely low-latency and ability to support 10,000+ simultaneous apps</li> </ul> </td> </tr> <tr> <td> <b>Mobile</b> <br /> <em>Tier 2 Support</em> </td> <td> <ul> <li>Render using Webview or - experimentally - with WGPU or Skia </li> <li>Support for iOS and Android </li> <li>Currently quite experimental, with lots of improvements coming throughout 2024 </li> </ul> </td> </tr> <tr> <td> <b>Terminal</b> <br /> <em>Tier 2 Support</em> </td> <td> <ul> <li>Render apps directly into your terminal, similar to <a href="https://github.com/vadimdemedes/ink"> ink.js</a></li> <li>Powered by the familiar flexbox and CSS model of the browser</li> <li>Built-in widgets like text input, buttons, and focus system</li> </ul> </td> </tr> </table> </div>

Running the examples

The examples in the main branch of this repository target the git version of dioxus and the CLI. If you are looking for examples that work with the latest stable release of dioxus, check out the 0.5 branch.

The examples in the top level of this repository can be run with:

cargo run --example <example>

However, we encourage you to download the dioxus-cli. If you are running the git version of dioxus, you can install the matching version of the CLI with:

cargo install --git https://github.com/DioxusLabs/dioxus dioxus-cli --locked

With the CLI, you can also run examples with the web platform. You just need to disable the default desktop feature and enable the web feature with this command:

dx serve --example <example> --platform web -- --no-default-features

Dioxus vs other frameworks

We love all frameworks and enjoy watching innovation in the Rust ecosystem. In fact, many of our projects are shared with other frameworks. For example, our flex-box library Taffy is used by Bevy, Zed, Lapce, Iced, and many more.

Dioxus places an emphasis on a few key points that make it different from other frameworks:

Dioxus vs Tauri

Tauri is a framework for building desktop mobile apps where your frontend is written in a web-based framework like React, Vue, Svelte, etc. Whenever you need to do native work, you can write Rust functions and call them from your frontend.

Dioxus vs Leptos

Leptos is a library for building fullstack web-apps, similar to SolidJS and SolidStart. The two libraries share similar goals on the web, but have several key differences:

fn Counters() -> Element {
    let mut counters = use_signal(|| vec![0; 10]);

    rsx! {
        button { onclick: move |_| counters.push(counters.len()), "Add Counter" }
        ul {
            for idx in 0..counters.len() {
                li {
                    button { onclick: move |_| counters.write()[idx] += 1, "{counters.index(idx)}" }
                    button { onclick: move |_| { counters.remove(idx); }, "Remove" }
                }
            }
        }
    }
}

While in Leptos you would use the <For> component.:

fn Counters() -> impl IntoView {
    let counters = RwSignal::new(vec![0; 10]);

    view! {
        <button on:click=move |_| counters.update(|n| n.push(n.len()))>"Add Counter"</button>
        <For
            each=move || 0..counters.with(Vec::len)
            key=|idx| *idx
            let:idx
        >
            <li>
                <button on:click=move |_| counters.update(|n| n[idx] += 1)>
                    {Memo::new(move |_| counters.with(|n| n[idx]))}
                </button>
                <button on:click=move |_| counters.update(|n| { n.remove(idx); })>
                    "Remove"
                </button>
            </li>
        </For>
    }
}
// dioxus
rsx! {
  div { class: "my-class", enabled: true, "Hello, {name}" }
}

// leptos
view! {
  <div class="my-class" enabled={true}>
    "Hello "
    {name}
  </div>
}

Dioxus vs Yew

Yew is a framework for building single-page web apps and initially served as an inspiration for Dioxus. Unfortunately, the architecture of Yew didn't support the various features we wanted, and thus Dioxus was born.

Dioxus vs egui

egui is a cross-platform GUI library for Rust powering tools like Rerun.io.

Dioxus vs Iced

Iced is a cross-platform GUI library inspired by Elm. Iced renders natively with WGPU and supports the web using DOM nodes.

Dioxus vs Electron

Dioxus and Electron are two entirely different projects with similar goals. Electron makes it possible for developers to build cross-platform desktop apps using web technologies like HTML, CSS, and JavaScript.

Contributing

<a href="https://github.com/dioxuslabs/dioxus/graphs/contributors"> <img src="https://contrib.rocks/image?repo=dioxuslabs/dioxus&max=30&columns=10" /> </a>

License

This project is licensed under either the MIT license or the Apache-2 License.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Dioxus by you, shall be licensed as MIT or Apache-2, without any additional terms or conditions.