Copy to clipboard
<Link href="/docs">Read more</Link>
<Link href="/docs">Read more</Link><Link href="/docs">Read more</Link>
Installation
npm install @vds-testing/react @vds-testing/stylesnpm install @vds-testing/elements @vds-testing/stylesSee Installation for CSS setup.
Usage
React:
import { Link } from "@vds-testing/react"<Link href="/docs">Documentation</Link>Web Components:
<script type="module">
import "@vds-testing/elements";
</script>
<vds-link href="/docs">Documentation</vds-link>Examples
With left icon
Copy to clipboard
<Link href="/docs">
<Mail slot="left-icon" size={16} />
Login with Email
</Link>
<Link href="/docs">
<Mail slot="left-icon" size={16} />
Login with Email
</Link><Link href="/docs">
<Mail slot="left-icon" size={16} />
Login with Email
</Link>
With right icon
Copy to clipboard
<Link href="/docs">
Add to Basket
<ArrowRight slot="right-icon" size={16} />
</Link>
<Link href="/docs">
Add to Basket
<ArrowRight slot="right-icon" size={16} />
</Link><Link href="/docs">
Add to Basket
<ArrowRight slot="right-icon" size={16} />
</Link>
Disabled
Copy to clipboard
<Link href="/docs" disabled>Disabled link</Link>
<Link href="/docs" disabled>Disabled link</Link><Link href="/docs" disabled>Disabled link</Link>
Focus state
Link follows the global text-based focus state guidelines:
- Yellow
--color-yellowbackground - 3px
blackbox-shadow at the bottom - Text color changes to black for contrast
Focus states are triggered by keyboard navigation (Tab key) and meet WCAG 2.2 contrast requirements.
Anatomy
Link- A single anchor element with slots for icons
Props
Link
| Prop | Type | Default | Description |
|---|---|---|---|
| href | string | - | Link destination |
| disabled | boolean | false | Disables the link |
| class | string | - | Additional CSS classes |
| leftIcon / rightIcon | ReactNode | - | React only. Astro and Web Components use slot="left-icon" / slot="right-icon" |