Loading...
Loading...
This skill should be used when writing Dioxus code, building Rust web/desktop/mobile apps with Dioxus, using RSX macro, signals, server functions, or any Dioxus features from 0.5+ (2024-2026).
npx skill4agent add nevaberry/nevaberry-plugins dioxus-knowledge-patch| Old (0.4) | New (0.5+) |
|---|---|
| |
| |
| |
| Per-platform launchers | |
| Operation | Syntax |
|---|---|
| Create | |
| Read (subscribes) | |
| Read (no subscribe) | |
| Write | |
| Global | |
| Mapped | |
references/signals-hooks.md| Pattern | Example |
|---|---|
| Conditional | |
| Conditional attr | |
| List with key | |
| Children prop | |
| Optional prop | |
| Prop into | |
references/rsx-patterns.mdconst LOGO: Asset = asset!("/assets/logo.png");
const HERO: Asset = asset!("/hero.png", ImageAssetOptions::new()
.format(ImageFormat::Avif).preload(true));
const STYLES: Asset = asset!("/app.css", CssAssetOptions::new().minify(true));| Feature | Syntax |
|---|---|
| Basic | |
| Route params | |
| Query params | |
| Middleware | |
| Extractors | |
references/fullstack.md#[derive(Routable, Clone, PartialEq)]
enum Route {
#[route("/")]
Home {},
#[route("/user/:id")]
User { id: u32 },
#[route("/files/:..path")] // Catch-all
Files { path: Vec<String> },
}references/router.md| Command | Purpose |
|---|---|
| Dev server with hot-reload |
| iOS simulator |
| Production build |
| Package for distribution |
| Route-based code splitting |
references/cli-desktop.md| File | Contents |
|---|---|
| Signals, use_memo, use_effect, use_resource, context |
| RSX syntax, props, events, conditionals, lists |
| Server functions, SSR, WebSocket, extractors |
| Routes, layouts, navigation, parameters |
| CLI commands, desktop config, platforms |
?#[component]
fn Profile(id: u32) -> Element {
let user = get_user(id)?; // Early return on error
rsx! { "{user.name}" }
}rsx! {
SuspenseBoundary {
fallback: |_| rsx! { "Loading..." },
AsyncChild {}
}
}
fn AsyncChild() -> Element {
let data = use_resource(fetch_data).suspend()?;
rsx! { "{data}" }
}use dioxus::document::{Title, Link, Meta};
rsx! {
Title { "My Page" }
Meta { name: "description", content: "..." }
Link { rel: "stylesheet", href: asset!("/style.css") }
}#[derive(Store)]
struct AppState {
users: BTreeMap<String, User>,
}
#[component]
fn UserList(state: Store<AppState>) -> Element {
let users = state.users();
rsx! {
for (id, user) in users.iter() {
UserRow { key: "{id}", user } // Only changed items re-render
}
}
}css_module!(Styles = "/styles.module.css", AssetOptions::css_module());
rsx! {
div { class: Styles::container, // Typed, compile-checked
p { class: Styles::title, "Hello" }
}
}use axum::Router;
use dioxus::prelude::*;
#[tokio::main]
async fn main() {
let app = Router::new()
.serve_static_assets("dist")
.serve_dioxus_application(ServeConfig::new(), App);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}// BAD: Won't update
let style = use_memo(move || format!("color: {}", color()));
rsx! { div { style: style } }
// GOOD: Direct signal read
rsx! { div { style: format!("color: {}", color()) } }// GOOD: Proper reactivity
rsx! {
p {
font_weight: if bold() { "bold" } else { "normal" },
text_align: "{align}",
}
}