pub struct LinkProps<'a> {
pub to: &'a str,
pub class: Option<&'a str>,
pub active_class: Option<&'a str>,
pub id: Option<&'a str>,
pub title: Option<&'a str>,
pub autodetect: bool,
pub external: bool,
pub new_tab: bool,
pub children: Element<'a>,
pub onclick: Option<EventHandler<'a, MouseEvent>>,
}Expand description
Props for the Link component.
Fields§
§to: &'a strThe route to link to. This can be a relative path, or a full URL.
// Absolute path
Link { to: "/home", "Go Home" }
// Relative path
Link { to: "../", "Go Up" }class: Option<&'a str>Set the class of the inner link ‘a’ element.
This can be useful when styling the inner link element.
active_class: Option<&'a str>Set the class added to the inner link when the current route is the same as the “to” route.
To set all of the active classes inside a Router at the same time use the active_class
prop on the Router component. If both the Router prop as well as this prop are provided then
this one has precedence. By default set to "active".
id: Option<&'a str>Set the ID of the inner link ‘a’ element.
This can be useful when styling the inner link element.
title: Option<&'a str>Set the title of the window after the link is clicked..
autodetect: boolAutodetect if a link is external or not.
This is automatically set to true and will use http/https detection
external: boolIs this link an external link?
new_tab: boolNew tab?
children: Element<'a>Pass children into the <a> element
onclick: Option<EventHandler<'a, MouseEvent>>The onclick event handler.
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 .to(...), .class(...)(optional), .active_class(...)(optional), .id(...)(optional), .title(...)(optional), .autodetect(...)(optional), .external(...)(optional), .new_tab(...)(optional), .children(...)(optional), .onclick(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of LinkProps.