Link
A styled hyperlink component.
use leptos::prelude::*; use singlestage::link::*; #[component] pub fn LinkExample() -> impl IntoView { view! { <Link href="#">"This is a link"</Link> } }
As Button
Use as_button to render a Link component with Button styling.
use leptos::prelude::*; use singlestage::*; #[component] pub fn LinkButtonExample() -> impl IntoView { view! { <div class="flex flex-col space-y-6"> <Link as_button=true size="sm" class="text-(--muted-foreground)" href="#"> "Learn More" {icon!(icondata::LuArrowUpRight)} </Link> <Link as_button=true variant="primary" href="#"> "Learn More" {icon!(icondata::LuArrowUpRight)} </Link> <Link as_button=true variant="secondary" href="#"> "Learn More" {icon!(icondata::LuArrowUpRight)} </Link> <Link as_button=true variant="outline" href="#"> "Learn More" {icon!(icondata::LuArrowUpRight)} </Link> </div> } }
Anatomy
Import all parts and piece them together.
use leptos::prelude::*; use singlestage::Link; #[component] pub fn LinkAnatomy() -> impl IntoView { view! { <Link /> } }
API Reference
Link
Creates a styled hyperlink.
| Name | Type | Default | Description |
|---|---|---|---|
| as_button | bool | false | Set whether or not this Link should appear as a Button. |
| mimetype | String | "" | Renamed <a> `type` attribute to avoid name collisions. |
| size | String | "" | For use with as_button, specify the size to render the button. |
| variant | String | "link" | For use with as_button, specify the style of button to render. |