Expand description
Website | Getting Started | Book (0.7) | Examples | Tutorial
Build for web, desktop, and mobile, and more with a single codebase. Zero-config setup, integrated hot-reloading, and signals-based state management. Add backend functionality with Server Functions and bundle with our CLI.
use dioxus::prelude::*;
fn main() {
dioxus::launch(app);
}
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
- Cross-platform apps in three lines of code (web, desktop, mobile, server, and more)
- Ergonomic state management combines the best of React, Solid, and Svelte
- Built-in featureful, type-safe, fullstack web framework
- Integrated bundler for deploying to the web, macOS, Linux, and Windows
- Subsecond Rust hot-patching and asset hot-reloading
- And more! Take a tour of Dioxus.
§Quick start
Grab the Dioxus CLI (dx) and spin up a new app in seconds:
# install the dioxus-cli
curl -fsSL https://dioxuslabs.com/install.sh | bash
# create a new app, following the template instructions
dx new my-app && cd my-app
# and then serve on `--web, --desktop, --ios, or --android`
dx serve --desktop§Guides
This overview doesn’t cover everything. Make sure to check out:
§Instant hot-reloading
With one command, dx serve and your app is running. Edit your markup, styles, and see changes in milliseconds. Use our experimental dx serve --hotpatch to update Rust code in real time.
§Build Beautiful Apps
Dioxus apps are styled with HTML and CSS. Use the built-in TailwindCSS support or load your favorite CSS library. Easily call into native code (objective-c, JNI, Web-Sys) for a perfect native touch.
§Truly fullstack applications
Dioxus deeply integrates with axum to provide powerful fullstack capabilities for both clients and servers. Pick from a wide array of built-in batteries like WebSockets, SSE, Streaming, File Upload/Download, Server-Side-Rendering, Forms, Middleware, and Hot-Reload, or go fully custom and integrate your existing axum backend.
§Experimental Native Renderer
Render using web-sys, webview, server-side-rendering, liveview, or even with our experimental WGPU-based renderer. Embed Dioxus in Bevy, WGPU, or even run on embedded Linux!
§First-party primitive components
Get started quickly with a complete set of primitives modeled after shadcn/ui and Radix-Primitives.
§First-class Android and iOS support
Dioxus is the fastest way to build native mobile apps with Rust. Simply run dx serve --platform android and your app is running in an emulator or on device in seconds. Call directly into JNI and Native APIs.
§Bundle for web, desktop, and mobile
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 5mb.
§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 Docs 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.
§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.
§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.
§Dioxus Crate Features
This crate has several features that can be enabled to change the active renderer and enable various integrations:
signals: (default) re-exportsdioxus-signalsmacro: (default) re-exportsdioxus-macrohtml: (default) exportsdioxus-htmlas the default elements to use in rsxhooks: (default) re-exportsdioxus-hookshot-reload: (default) enables hot rsx reloading in all renderers that support itrouter: exports the router and enables any router features for the current platformthird-party-renderer: Just disables warnings about no active platform when no renderers are enabledlogger: Enable the default tracing subscriber for Dioxus apps
Platform features (the current platform determines what platform the launch() function runs):
fullstack: enables the fullstack platform. This must be used in combination with thewebfeature for wasm builds andserverfeature for server buildsdesktop: enables the desktop platformmobile: enables the mobile platformweb: enables the web platform. If the fullstack platform is enabled, this will set the fullstack platform to client modeliveview: enables the liveview platformserver: enables the server variant of dioxus
Re-exports§
pub use dioxus_core;pub use dioxus_core as core;pub use dioxus_hooks as hooks;hookspub use dioxus_signals as signals;signalspub use dioxus_stores as stores;signalspub use dioxus_document as document;documentpub use dioxus_history as history;documentpub use dioxus_html as html;htmlpub use dioxus_core_macro as core_macro;macropub use dioxus_logger as logger;loggerpub use dioxus_cli_config as cli_config;cli-configpub use dioxus_server as server;serverpub use dioxus_devtools as devtools;devtoolspub use dioxus_web as web;webpub use dioxus_router as router;routerpub use dioxus_fullstack as fullstack;fullstackpub use dioxus_liveview as liveview;liveviewpub use dioxus_ssr as ssr;ssrpub use warnings;warningspub use dioxus_config_macros as config_macros;pub use subsecond;
Modules§
- asset_
resolver asset - The asset resolver for the Dioxus bundle format. Each platform has its own way of resolving assets. This crate handles resolving assets in a cross-platform way.
- events
- prelude
Structs§
- Captured
Error - An
anyhow::Errorwrapped in anArcso it can be cheaply cloned and passed around. - Launch
Builder launch - A builder for a fullstack app.
Functions§
- Ok
- Equivalent to
Ok::<_, dioxus::CapturedError>(value). - launch
launch - Launch your Dioxus application with the given root component, context and config. The platform will be determined from cargo features.
- serve
server - Serve a fullstack dioxus application with a custom axum router.
Type Aliases§
- Context
Fn launch - A context function is a Send and Sync closure that returns a boxed trait object
- Launch
Fn launch - Result
- A result type with a default error of
CapturedError.