From 97bbdf561ab7a948f100b79c1f7b7489987a390e Mon Sep 17 00:00:00 2001
From: Houski <76850549+Houski@users.noreply.github.com>
Date: Thu, 30 Mar 2023 14:28:08 -0600
Subject: [PATCH] feat: added the `id` attribute to the Leptos router ``
tag (#770)
---
router/src/components/link.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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)
}