| Crates.io | dioxus-transition |
| lib.rs | dioxus-transition |
| version | 0.3.2 |
| created_at | 2025-05-17 11:59:30.606266+00 |
| updated_at | 2026-01-13 11:58:49.529836+00 |
| description | A Dioxus component for enter/leave transitions |
| homepage | |
| repository | https://github.com/dsplce-co/dioxus-transition |
| max_upload_size | |
| id | 1677821 |
| size | 75,161 |
We're dsplce.co, check out our work on our website: dsplce.co π€
π¬ Seamless transitions in Dioxus, inspired by Vueβs
<Transition>β declarative, built-in, composable.
This crate provides a fully reactive <Transition> component for Dioxus, allowing you to animate elements when they enter or leave the DOM.
β
Transition component for conditional DOM animations
β
Vue-style logic with signal-reactive updates
β
Built-in transitions: fade, blur β easy to extend
β
Opt-out of built-ins via default-features = false
β
Built for flexibility: own styles, fine-grained control
Add it to your Cargo.toml:
[dependencies]
dioxus-transition = { version = "0.3" }
or:
[dependencies]
dioxus-transition = { version = "0.3", default-features = false }
to disable the default stylesheet (opt out of default transition kinds).
The latest version of this crate requires Dioxus version 0.7. Check the compatibility table for other supported Dioxus versions.
You need to enable the crate's SSR feature on the server for fullstack apps:
[features]
server = ["dioxus/server", "dioxus-transition/ssr"]
This will tell dioxus-transition not to perform DOM-related operations at the stage of server side rendering.
use dioxus::prelude::*;
use dioxus_transition::prelude::*;
fn main() {
dioxus::web::launch(App);
}
#[component]
fn App() -> Element {
let mut visible = use_signal(bool::default);
rsx! {
div {
button {
onclick: move |_| visible.set(!visible()),
"Toggle"
}
Transition {
id: "square",
kind: "fade", // try "blur", or define your own
duration: 300,
if visible() {
div {
id: "square",
display: "block",
width: "200px",
height: "200px",
background: "red",
}
}
}
}
}
}
The <Transition> component:
Tracks whether its children are present or a placeholder (<!--placeholder-->)
On entrance: injects *-transition-hidden, then animates in with *-transition-activating
On exit: runs reverse animation and cleans up
You control:
id: DOM node to animatekind: animation class prefix (e.g. fade)duration: in msignore_first: skip entrance animation on first mount (default: false)/* fade */
.fade-transition-hidden {
opacity: 0;
}
.fade-transition-activating {
opacity: 1;
}
/* blur */
.blur-transition-hidden {
backdrop-filter: brightness(1) blur(0);
}
.blur-transition-activating {
backdrop-filter: brightness(0.375) blur(2px);
}
Donβt like them? Set default-features = false and roll your own π§
Use any CSS class name as kind. All that matters is you provide these two classes:
.<kind>-transition-hidden β hidden state.<kind>-transition-activating β visible state| Dioxus version | dioxus-transition version |
|---|---|
0.7 |
0.3 |
0.6 |
0.2 |
π¦ Crate: crates.io/crates/dioxus-transition
π οΈ Repo: github.com/dsplce-co/dioxus-transition
Contributions, issues, ideas? Hit us up β let's make transitions in Dioxus delightful π€
MIT or Apache-2.0, at your option.