DioxusLabs / DioxusLabs/docsite

Add Documentation for DioxusFormattable Trait

Open
#446 0 comments 2 reactions 0 assignees View on GitHub
documentation enhancement
Dominant language
Rust
Stars
206
Forks
208
Avg merge
1h 11m
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the DioxusFormattable trait in the Dioxus source and reviewing how it is used for custom types. Document its purpose, implementation guidance, and the Icon wrapper around Asset example from the issue. Done means the official documentation explains usage and best practices clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.