Function freya::prelude::Link

source ·
pub fn Link(_: LinkProps) -> Result<VNode, RenderError>
Expand description

Similar to Link, but you can use it in Freya. Both internal routes (dioxus-router) and external links are supported. When using internal routes make sure the Link is descendant of a Router component.

§Styling

Inherits the LinkTheme theme.

§Example

With Dioxus Router:

rsx! {
    Link {
        to: AppRouter::Settings,
        label { "App Settings" }
    }
}

With external routes:

rsx! {
    Link {
        to: "https://crates.io/crates/freya",
        label { "Freya crates.io" }
    }
}

§Props

For details, see the props struct definition.

  • theme : Option<LinkThemeWith>

    Theme override.

  • to : IntoRoutable

    The route or external URL string to navigate to.

  • children : Element

    Inner children for the Link.

  • onerror : Option<EventHandler<()>>

    This event will be fired if opening an external link fails.

  • tooltip : Option<LinkTooltip>

    A little text hint to show when hovering over the anchor.

    Setting this to None is the same as LinkTooltip::Default. To remove the tooltip, set this to LinkTooltip::None.