dioxus-theme
Dioxus components and native metadata for no-reload theme switching.
This crate is part of the Dioxus SSR package workspace. The APIs are pre-1.0 and may change between releases while the package family stabilizes.
Release Status
- Current crate version:
0.1.0-alpha.4. - Release wave: June 8, 2026 workspace integration update.
- Publish status: Prepared as a crates.io update for this package.
- Scope: Dioxus components and native metadata for no-reload theme switching.
- The README install examples and local workspace dependency requirements are aligned with this publish wave.
Install
[]
= "0.1.0-alpha.4"
What It Provides
ThemeProvider,ThemeToggle,ThemeSelect,ThemeAnimationSelect, andThemeAnimationSpeedSlidercomponents.use_themestorage hook backed by the native-port storage adapter.- Native package action metadata for theme, animation preset, and animation speed controls.
- Re-exports for core config, animation presets, validation types, built-in token constants, and visual-token manifest helpers.
Controls
use *;
use ;
The controls render SSR-safe HTML using data-dxr-on-* resumability attributes. They include stable ids, accessible labels, aria-live current labels, and slider output text. The default handler ids are:
theme.toggletheme.settheme.cycletheme.animationtheme.animation-speed
Visual Token Interop
dioxus-theme re-exports the semantic token contract used by visual packages:
use ;
let manifest = theme_visual_token_manifest;
assert_eq!;
assert!;
The browser runtime includes tokens, visualTokens, and visualTokenCssVars in every dioxus-theme:change event, so Shader palettes, HoverFX sand/texture colors, and TextFX gradient colors can react to theme changes without page reload.
use ;
let shader_palette = ;
let hoverfx_sand = ;
let textfx_gradient = ;
}
}
Native Metadata
Use theme_native_package_actions(route) to advertise native-port actions for non-web shells. theme_native_action returns the configured storage keys, active animation preset, animation speed, and fallback mode so native hosts can mirror the same controls.
Integration Recipes
The component prelude includes the core integration helpers for route manifests, asset-budget categories, and migration planning:
use *;
let config = theme_cfg.with_default_theme;
let policy = theme_route_policy.route;
let manifest = theme_component_manifest;
let plan = theme_workertown_offload_plan;
assert_eq!;
assert!;
Prefer the package-prefixed theme_* helper names for integration code.
Component aliases such as Theme, Toggle, Select, AnimSelect, and
SpeedSlider are intended for RSX-facing code.
Workspace package dependencies:
dioxus-native-portdioxus-theme-core
Feature Flags
default:webdesktop:dioxus/desktopnative:dioxus/native,dioxus-native-port/nativeserver:dioxus/serverviewtx: forwards the optionaldioxus-theme-core/viewtxinterop featureweb:dioxus/web,dioxus-native-port/web
License
Licensed under either of:
- MIT license (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
Repository: https://github.com/Collin-Budrick/dioxus_template