No Description

Jonathan Kelley a62e729bfa Release dioxus v0.2.4 3 years ago
.docker fc0a093466 try fix 3 years ago
.github 1594ac386c Update docs.yml 3 years ago
.vscode b0183b76cd release: add posts for releases 3 years ago
benches 91b2147552 update benchmark 3 years ago
docs f7e67cb2d7 Merge pull request #329 from Demonthos/lazy_tui 3 years ago
examples 07529e491c fix: subscription should apply internally to hook 3 years ago
notes 9d285d842d Update ZH_CN.md 3 years ago
packages cf378d34d8 fix: add version for package 3 years ago
src f7e67cb2d7 Merge pull request #329 from Demonthos/lazy_tui 3 years ago
tests 93405c2a40 Fix: diffing should poproots too 3 years ago
.gitignore 8d42191d7a Add `From` trait to convert web_sys Events to html Data 3 years ago
CHANGELOG.md 56f3002aed feat: add changelogs 3 years ago
Cargo.toml 4ef2cfaba5 fix: specify version 3 years ago
LICENSE-APACHE 6537ad37b8 Add actual copies of the relevant licenses 3 years ago
LICENSE-MIT 6537ad37b8 Add actual copies of the relevant licenses 3 years ago
Makefile.toml bd565bb65f improve Makefile tests 3 years ago
README.md a94bccfb46 feat: add tui to readme 3 years ago
codecov.yml e03f8ca90c ci: no more codecov failing 3 years ago

README.md

Dioxus


Dioxus is a portable, performant, and ergonomic framework for building cross-platform user interfaces in Rust.

fn app(cx: Scope) -> Element {
    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 sites, mobile apps, TUI apps, liveview apps, and more. Dioxus is entirely renderer agnostic and can be used as platform for any renderer.

If you know React, then you already know Dioxus.

Unique features:

  • Desktop apps running natively (no Electron!) in less than 10 lines of code.
  • Incredibly ergonomic and powerful state management.
  • Comprehensive inline documentation - hover and guides for all HTML elements, listeners, and events.
  • Extremely memory efficient - 0 global allocations for steady-state components.
  • Multi-channel asynchronous scheduler for first-class async support.
  • And more! Read the full release post.

Get Started with...

Example Projects:

Tutorial Web Desktop SSR Mobile State
File Navigator (Desktop) WiFi scanner (Desktop) TodoMVC (All platforms) E-commerce w/ Tailwind (SSR/LiveView)
File Explorer Wifi Scanner Demo TodoMVC example E-commerce Example

See the awesome-dioxus page for a curated list of content in the Dioxus Ecosystem.

Why Dioxus and why Rust?

TypeScript is a fantastic addition to JavaScript, but it's still fundamentally JavaScript. TS code runs slightly slower, has tons of configuration options, and not every package is properly typed.

By using Rust, we gain:

  • Static types for every library
  • Immutability by default
  • A simple and intuitive module system
  • Integrated documentation (go to source actually goes to source)
  • Advanced pattern matching
  • Clean, efficient, composable iterators
  • Inline built-in unit/integration testing
  • Best-in-class error handling
  • Powerful and sane standard library
  • Flexible macro system
  • Access to crates.io

Specifically, Dioxus provides us many other assurances:

  • Proper use of immutable data structures
  • Guaranteed error handling (so you can sleep easy at night not worrying about cannot read property of undefined)
  • Native performance on mobile
  • Direct access to system IO

And much more. Dioxus makes Rust apps just as fast to write as React apps, but affords more robustness, giving your frontend team greater confidence in making big changes in shorter time.

Why NOT Dioxus?

You shouldn't use Dioxus if:

  • You don't like the React Hooks approach to frontend
  • You need a no-std renderer
  • You want to support browsers where Wasm or asm.js are not supported.
  • You need a Send+Sync UI solution (Dioxus is not currently thread-safe)

Comparison with other Rust UI frameworks

Dioxus primarily emphasizes developer experience and familiarity with React principles.

  • Yew: prefers the elm pattern instead, no borrowed props, supports SSR (no hydration), no direct desktop/mobile support.
  • Percy: Supports SSR but with less emphasis on state management and event handling.
  • Sycamore: VDOM-less using fine-grained reactivity, but no direct support for desktop/mobile.
  • Dominator: Signal-based zero-cost alternative, less emphasis on community and docs.
  • Azul: Fully native HTML/CSS renderer for desktop applications, no support for web/ssr

Parity with React & Roadmap

Dioxus is heavily inspired by React, but we want your transition to feel like an upgrade. Dioxus is most of the way there, but missing a few key features. These include:

  • Portals
  • Suspense integration with SSR
  • Server Components / Bundle Splitting / Lazy

Dioxus is unique in the Rust ecosystem in that it supports:

  • Components with props that borrow from their parent
  • Server-side-rendering with client-side hydration
  • Support for desktop applications

For more information on what features are currently available and the roadmap for the future, be sure to check out the guide.

Projects in the ecosystem

Want to jump in and help build the future of Rust frontend? There's plenty of places where your contributions can make a huge difference:

License

This project is licensed under the MIT license.

Contribution

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