Struct dioxus_router::components::LinkProps
source · pub struct LinkProps<'a> {
pub active_class: Option<&'a str>,
pub children: Element<'a>,
pub class: Option<&'a str>,
pub id: Option<&'a str>,
pub new_tab: bool,
pub onclick: Option<EventHandler<'a, MouseEvent>>,
pub onclick_only: bool,
pub rel: Option<&'a str>,
pub to: IntoRoutable,
}Expand description
The properties for a Link.
Fields§
§active_class: Option<&'a str>A class to apply to the generate HTML anchor tag if the target route is active.
children: Element<'a>The children to render within the generated HTML anchor tag.
class: Option<&'a str>The class attribute for the generated HTML anchor tag.
If active_class is Some and the target route is active, active_class will be
appended at the end of class.
id: Option<&'a str>The id attribute for the generated HTML anchor tag.
new_tab: boolWhen true, the target route will be opened in a new tab.
This does not change whether the Link is active or not.
onclick: Option<EventHandler<'a, MouseEvent>>The onclick event handler.
onclick_only: boolWhether the default behavior should be executed if an onclick handler is provided.
rel: Option<&'a str>The rel attribute for the generated HTML anchor tag.
For external targets, this defaults to noopener noreferrer.
to: IntoRoutableThe navigation target. Roughly equivalent to the href attribute of an HTML anchor tag.
Implementations§
source§impl<'a> LinkProps<'a>
impl<'a> LinkProps<'a>
sourcepub fn builder() -> LinkPropsBuilder<'a, ((), (), (), (), (), (), (), (), ())>
pub fn builder() -> LinkPropsBuilder<'a, ((), (), (), (), (), (), (), (), ())>
Create a builder for building LinkProps.
On the builder, call .active_class(...)(optional), .children(...)(optional), .class(...)(optional), .id(...)(optional), .new_tab(...)(optional), .onclick(...)(optional), .onclick_only(...)(optional), .rel(...)(optional), .to(...) to set the values of the fields.
Finally, call .build() to create the instance of LinkProps.