Frontend that scales.
Dioxus is a portable, performant, and ergonomic framework for building cross-platform user experiences in Rust.
fn App(cx: Context<()>) -> VNode {
let mut count = use_state(cx, || 0);
cx.render(rsx! {
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
})
};
Dioxus can be used to deliver webapps, desktop apps, static pages, liveview apps, eventually mobile apps (WIP), and more. At its core, Dioxus is entirely renderer agnostic and has great documentation for creating new renderers for any platform.
If you know React, then you already know Dioxus.
Web | Desktop | Mobile | State | Docs | Tools |
---|---|---|---|---|---|
Feature | Dioxus | React | Notes for Dioxus |
---|---|---|---|
Conditional Rendering | ✅ | ✅ | if/then to hide/show component |
Map, Iterator | ✅ | ✅ | map/filter/reduce to produce rsx! |
Keyed Components | ✅ | ✅ | advanced diffing with keys |
Web | ✅ | ✅ | renderer for web browser |
Desktop (webview) | ✅ | ✅ | renderer for desktop |
Shared State (Context) | ✅ | ✅ | share state through the tree |
Hooks | ✅ | ✅ | memory cells in components |
SSR | ✅ | ✅ | render directly to string |
Component Children | ✅ | ✅ | cx.children() as a list of nodes |
Headless components | ✅ | ✅ | components that don't return real elements |
Fragments | ✅ | ✅ | multiple elements without a real root |
Manual Props | ✅ | ✅ | Manually pass in props with spread syntax |
Controlled Inputs | ✅ | ✅ | stateful wrappers around inputs |
CSS/Inline Styles | ✅ | ✅ | syntax for inline styles/attribute groups |
Custom elements | ✅ | ✅ | Define new element primitives |
Suspense | 🛠 | ✅ | schedule future render from future/promise |
Cooperative Scheduling | 🛠 | ✅ | Prioritize important events over non-important events |
Fine-grained reactivity | 🛠 | ❓ | Skip diffing for fine-grain updates |
Runs natively | ✅ | ❓ | runs as a portable binary w/o a runtime (Node) |
1st class global state | ✅ | ❓ | redux/recoil/mobx on top of context |
Subtree Memoization | ✅ | ❓ | skip diffing static element subtrees |
Compile-time correct | ✅ | ❓ | Throw errors on invalid template layouts |
Heuristic Engine | 🛠 | ❓ | track component memory usage to minimize future allocations |
NodeRef | 🛠 | ✅ | gain direct access to nodes [1] |
Feature | Dioxus | React | Notes for Dioxus |
---|---|---|---|
1st class router | 👀 | ✅ | Hook built on top of history |
Assets | 👀 | ✅ | include css/svg/img url statically |
Integrated classnames | 🛠 | ❓ | built-in classnames |
Transition | 👀 | 🛠 | High-level control over suspense |
Animation | 👀 | ✅ | Spring-style animations |
Mobile | 👀 | ✅ | Render with cacao |
Desktop (native) | 👀 | ✅ | Render with native desktop |
3D Renderer | 👀 | ✅ | react-three-fiber |
Feature | Dioxus | React | Notes for Dioxus |
---|---|---|---|
Portal | ❓ | ✅ | cast elements through tree |
Error/Panic boundary | ❓ | ✅ | catch panics and display custom BSOD |
Code-splitting | 👀 | ✅ | Make bundle smaller/lazy |
LiveView | 👀 | ❓ | Example for SSR + WASM apps |