diff --git a/router/src/components/link.rs b/router/src/components/link.rs
index 0fa7440ef..92bcd44be 100644
--- a/router/src/components/link.rs
+++ b/router/src/components/link.rs
@@ -61,6 +61,9 @@ where
/// will skip this page.)
#[builder(default)]
pub replace: bool,
+ /// Sets the `class` attribute on the underlying `` tag, making it easier to style.
+ #[builder(default, setter(strip_option, into))]
+ pub class: Option>,
/// The nodes or elements to be shown inside the link.
pub children: Box Fragment>
}
@@ -92,6 +95,8 @@ where
}
});
+ let class = props.class;
+
Component::new("A", move |cx| {
cfg_if! {
if #[cfg(any(feature = "csr", feature = "hydrate"))] {
@@ -101,6 +106,7 @@ where
prop:state={props.state.map(|s| s.to_js_value())}
prop:replace={props.replace}
aria-current=move || if is_active.get() { Some("page") } else { None }
+ class=move || class.as_ref().map(|class| class.get())
>
{props.children}
@@ -110,6 +116,7 @@ where
{props.children}