mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 16:54:41 -05:00
Compare commits
1 Commits
subsecond
...
document-a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d7fe46661 |
@@ -66,6 +66,25 @@ where
|
||||
/// This is helpful for accessibility and for styling. For example, maybe you want to set the link a
|
||||
/// different color if it’s a link to the page you’re currently on.
|
||||
///
|
||||
/// ### Additional Attributes
|
||||
///
|
||||
/// You can add additional HTML attributes to the `<a>` element created by this component using the attribute
|
||||
/// spreading syntax for components. For example, to add a class, you can use `attr:class="my-link"`.
|
||||
/// Alternately, you can add any number of HTML attributes (include `class`) after a `{..}` marker.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use leptos::prelude::*; use leptos_router::components::A;
|
||||
/// # fn spread_example() -> impl IntoView {
|
||||
/// view! {
|
||||
/// <A href="/about" attr:class="my-link" {..} id="foo">"Some link"</A>
|
||||
/// <A href="/about" {..} class="my-link" id="bar">"Another link"</A>
|
||||
/// <A href="/about" {..} class:my-link=true id="baz">"One more"</A>
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// For more information on this attribute spreading syntax, [see here](https://book.leptos.dev/view/03_components.html#spreading-attributes-onto-components).
|
||||
///
|
||||
/// ### DOM Properties
|
||||
///
|
||||
/// `<a>` elements can take several additional DOM properties with special meanings.
|
||||
|
||||
Reference in New Issue
Block a user