Function silkenweb::router::anchor

source ·
pub fn anchor<D: Dom>(path: impl Into<String>) -> A<D>
Expand description

Set up an HTML <a> element for routing.

Return an <a> element builder with the href attribute set to path and an on_click handler. Modifier keys are correctly handled.

Example

use silkenweb::{prelude::*, router::anchor};
let link: A = anchor("/my-path").text("click me");