diff --git a/router/src/components/link.rs b/router/src/components/link.rs index 645d62af2..8bf2fe53c 100644 --- a/router/src/components/link.rs +++ b/router/src/components/link.rs @@ -62,6 +62,9 @@ pub fn A( /// Sets the `class` attribute on the underlying `` tag, making it easier to style. #[prop(optional, into)] class: Option, + /// Sets the `id` attribute on the underlying `` tag, making it easier to target. + #[prop(optional, into)] + id: Option, /// The nodes or elements to be shown inside the link. children: Children, ) -> impl IntoView @@ -75,6 +78,7 @@ where state: Option, replace: bool, class: Option, + id: Option, children: Children, ) -> HtmlElement { #[cfg(not(any(feature = "hydrate", feature = "csr")))] @@ -109,6 +113,7 @@ where prop:replace={replace} aria-current=move || if is_active.get() { Some("page") } else { None } class=class + id=id > {children(cx)} @@ -116,5 +121,5 @@ where } let href = use_resolved_path(cx, move || href.to_href()()); - inner(cx, href, exact, state, replace, class, children) + inner(cx, href, exact, state, replace, class, id, children) }