Problem
Sometimes the tailwind classes in active_class do not get applied. I assume this is dependent on the order the tailwind classes, and not how it is in the html/rsx.
Steps To Reproduce
Might not result in the "failed" style, due to "correct" css order.
Link {
class: "text-gray-700 dark:text-gray-400",
active_class: "text-red-700 dark:text-brand-400",
to: Route::Home,
"Home"
}
Expected behavior
A solution might be to add a ! in front of the active tailwind classes.
Link {
class: "text-gray-700 dark:text-gray-400",
active_class: "!text-red-700 dark:!text-brand-400",
to: Route::Home,
"Home"
}
Another option might be to add an inactive_class to the Link component. Such that class is always active. And depending on the route, active_class or inactive_class are added.
Environment:
- Dioxus version: 0.7.1
- Rust version: 1.93.0
- OS info: bazzite-43.20260212
- App platform: web
Questionnaire
I would like to fix and I have a possible solution.
Problem
Sometimes the tailwind classes in
active_classdo not get applied. I assume this is dependent on the order the tailwind classes, and not how it is in the html/rsx.Steps To Reproduce
Might not result in the "failed" style, due to "correct" css order.
Expected behavior
A solution might be to add a
!in front of the active tailwind classes.Another option might be to add an
inactive_classto the Link component. Such thatclassis always active. And depending on the route,active_classorinactive_classare added.Environment:
Questionnaire
I would like to fix and I have a possible solution.