Link
This component extends the <a> HTML element (or anchor element) and is used to display hyperlinks.
Usage
Examples
Using asChild for Custom Links
If you need to use the Link component provided by a different package, you can use the
asChild prop and wrap the component. Here's an example using Next.js:
You can also create a custom component and import it as needed:
Open in a New Tab
Opens the link in a new tab by setting target="_blank".
Note
All current versions of major browsers now automatically use the behaviour of
rel="noopener" for any links with target="_blank"
Primary
Used to toggle the link text colour.
Underline
Controls when the link should have an underline.
Props
Link
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
href | string | - |
newTab | boolean | false |
primary | boolean | false |
underline | enum | always |