dioxus README

The project's README from github.com/DioxusLabs/dioxus. As one markdown file: README.md.


Crates.io version Download docs.rs docs CI status Awesome Page Discord Link

Website | Examples | Tutorial | 中文 | PT-BR | 日本語 | Türkçe | 한국어



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.

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, 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. Fun fact: we use the Dioxus website as a testbed for new Dioxus features - check it out!

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.

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

Web
  • Render directly to the DOM using WebAssembly
  • Pre-render with SSR and rehydrate on the client
  • Simple "hello world" at about 50kb, comparable to React
  • Built-in dev server and hot reloading for quick iteration
Desktop
  • Render using Webview or - experimentally - with WGPU or Freya (Skia)
  • Zero-config setup. Simply `cargo run` or `dx serve` to build your app
  • Full support for native system access without IPC
  • Supports macOS, Linux, and Windows. Portable <3mb binaries
Mobile
  • Render using Webview or - experimentally - with WGPU or Skia
  • Build .ipa and .apk files for iOS and Android
  • Call directly into Java and Objective-C with minimal overhead
  • From "hello world" to running on device in seconds
Server-side Rendering
  • Suspense, hydration, and server-side rendering
  • Quickly drop in backend functionality with server functions
  • Extractors, middleware, and routing integrations
  • Static-site generation and incremental regeneration

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.6 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 to test out features like hot-reloading. To install the most recent binary CLI, you can use cargo binstall.

curl -fsSL https://dioxuslabs.com/install.sh | bash

If this CLI is out-of-date, you can install it directly from git or cargo-binstall

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

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

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

Contributing

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 (DioxusLabs/dioxus)

Searching Database…

39.4K ·GitHub
这是什么?Dioxus 是一个用 Rust 构建应用的框架,用一套代码就能运行在网页、桌面、移动端和服务器上。
它是框架还是库?它是一个全栈 UI 框架,自带命令行工具、打包器和渲染器,不只是一个组件库。
我该怎么让它跑起来?安装 dioxus-cli,然后运行 'dx serve' 启动带热重载的开发服务器;用 'dx bundle' 打包最终应用。
开发时必须安装 Dioxus CLI 吗?是的,热重载和运行示例都需要 CLI(dx);你可以通过 cargo binstall 安装,也可以直接从 git 安装。
原生 WGPU 渲染器和 Rust 热补丁现在稳定了吗?还没有,WGPU/Skia 渲染器和 'dx serve --hotpatch' 的 Rust 热补丁都被明确标记为实验性功能。
它实际支持哪些平台?网页(WASM/DOM)、桌面(macOS、Linux、Windows,通过 Webview)、移动端(iOS 和 Android,通过 Webview),以及服务端渲染。
状态管理是怎么工作的?Dioxus 使用基于信号(signals)的响应式状态系统,融合了 React、Solid 和 Svelte 的思路,让更新更顺手。
我能复用现有的样式工具吗?可以,应用使用原生 HTML/CSS 编写样式,并内置 TailwindCSS 支持,你也可以使用自己的 CSS 库。
生成的应用包有多小?得益于集成的优化打包器,网页应用可以打包到 50kb 以下,桌面和移动应用可以控制在 5mb 以下。
它能和现有的后端集成吗?可以,它与 axum Web 框架深度集成,开箱即用地提供 WebSockets、SSE、流式传输、文件上传、SSR、表单和中间件。
Creator
DioxusLabs
Size
56.3 MB
Stars
39.4K
Age
5y
Commits · 90 Days