Contributing
Development happens in the Dioxus GitHub repository. If you've found a bug or have an idea for a feature, please submit an issue (but first check if someone hasn't done it already).
GitHub discussions can be used as a place to ask for help or talk about features. You can also join our Discord channel where some development discussion happens.
Improving Docs
If you'd like to improve the docs, PRs are welcome! The Rust docs (source) and this guide (source) can be found in their respective GitHub repos.
Working on the Ecosystem
Part of what makes React great is the rich ecosystem. We'd like the same for Dioxus! So if you have a library in mind that you'd like to write and many people would benefit from, it will be appreciated. You can browse npm.js for inspiration. Once you are done, add your library to the awesome dioxus list or share it in the #I-made-a-thing
channel on Discord.
Bugs & Features
If you've fixed an open issue, feel free to submit a PR! You can also take a look at the roadmap and work on something in there. Consider reaching out to the team first to make sure everyone's on the same page, and you don't do useless work!
All pull requests (including those made by a team member) must be approved by at least one other team member.
Before you contribute
You might be surprised that a lot of checks fail when making your first PR.lots of time, because the
- Format code with rustfmt:
cargo fmt -- src/**/**.rs
- You might need to install some packages on Linux (Ubuntu/deb) before the following commands will complete successfully (there is also a Nix flake in the repo root):
sudo apt install libgdk3.0-cil libatk1.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev
- Check all code cargo check:
cargo check --workspace --examples --tests
- Check if Clippy generates any warnings. Please fix these!
cargo clippy --workspace --examples --tests -- -D warnings
- Test all code with cargo-test:
cargo test --all --tests
- More tests, this time with cargo-make. Here are all steps, including installation:
cargo install --force cargo-make cargo make tests
- Test unsafe crates with MIRI. Currently, this is used for the two MIRI tests in
dioxus-core
anddioxus-native-core
:
cargo miri test --package dioxus-core --test miri_stress cargo miri test --package dioxus-native-core --test miri_native
- Test with Playwright. This tests the UI itself, right in a browser. Here are all steps, including installation:Disclaimer: This might inexplicably fail on your machine without it being your fault. Make that PR anyway!
cd playwright-tests npm ci npm install -D @playwright/test npx playwright install --with-deps npx playwright test
How to test dioxus with local crate
If you are developing a feature, you should test it in your local setup before raising a PR. This process makes sure you are aware of your code functionality before being reviewed by peers.
- Fork the following github repo (DioxusLabs/dioxus):
https://github.com/DioxusLabs/dioxus
- Create a new or use an existing rust crate (ignore this step if you will use an existing rust crate):
cargo new --bin demo
- Add the dioxus dependency to your rust crate (new/existing) in Cargo.toml:
dioxus = { path = "<path to forked dioxus project>/dioxus/packages/dioxus", features = ["web", "router"] }
This above example is for dioxus-web, with dioxus-router. To know about the dependencies for different renderer visit here.
- Run and test your feature
dx serve
If this is your first time with dioxus, please read the guide to get familiar with dioxus.