You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the DioxusFormattable trait in Dioxus lacks official documentation. This trait is useful for custom types that need to be formatted as strings within the framework.
In my use case, I created a wrapper struct Icon around Asset and implemented DioxusFormattable for it. This allows Icon instances to be used seamlessly as formatted strings in components.
Example usage:
#[derive(PartialEq, Props, Clone)]
pub struct MenuProps {
icon: Icon,
children: Element,
#[props(into)]
to: NavigationTarget,
}
#[component]
pub fn ManuLink(props: MenuProps) -> Element {
let MenuProps { to, children, icon } = props;
rsx! {
Link {
to,
div {
class: "flex items-center gap-8 p-5 rounded hover:bg-secondary-darker",
img {src: icon}
{children}
}
}
}
}
Adding documentation for DioxusFormattable would help developers understand its purpose, usage, and best practices for implementing it in their own projects.
The text was updated successfully, but these errors were encountered:
Currently, the DioxusFormattable trait in Dioxus lacks official documentation. This trait is useful for custom types that need to be formatted as strings within the framework.
In my use case, I created a wrapper struct Icon around Asset and implemented DioxusFormattable for it. This allows Icon instances to be used seamlessly as formatted strings in components.
Example usage:
Adding documentation for DioxusFormattable would help developers understand its purpose, usage, and best practices for implementing it in their own projects.
The text was updated successfully, but these errors were encountered: