Link
Basic
<Link href="https://example.com">Example</Link>Underline
Set
underline to either "always", "hover" or "none". Defaults to "always".It is important to indicate that links are clickable. Underlining is a popular way of achieving this goal, but there are many others. The best approach will depend on the context. See Beyond Blue Links: Making Clickable Elements Recognizable for more information.
<Flex className="gap-3">
<Link underline="always" href="https://example.com">always</Link>
<Link underline="hover" href="https://example.com">hover</Link>
<Link underline="none" href="https://example.com">none</Link>
</Flex>In-page link
Set
inPageLink to either true or false. Defaults to false.When
true, adds a "#" on hover to the left of the text.See Anchors OK? Re-Assessing In-Page Links from Nielsen Norman Group.
<Link inPageLink underline="hover" href="#section">
Example
</Link>New tab
Set
_newTab to either true or false. Defaults to false.When
true, sets target="blank" and rel="noopener noreferrer" to get the link to open in a new tab.Note: Despite being relatively commonly seen on the web, it is generally inadvisable to do this. See Opening Links in New Browser Windows and Tabs.
Note: When
_newTab is true, if _includeNewTabIcon is also true, there will be an icon at the end of the text indicating that the link will open in a new tab.<Stack className="gap-8">
<Stack className="gap-5">
<Link _newTab href="https://example.com" underline="always">
_newTab
</Link>
<Link _newTab href="https://example.com" underline="hover">
_newTab
</Link>
<Link _newTab href="https://example.com" underline="none">
_newTab
</Link>
</Stack>
<Stack className="gap-5">
<Link
_newTab
_includeNewTabIcon
href="https://example.com"
underline="always"
>
_includeNewTabIcon
</Link>
<Link
_newTab
_includeNewTabIcon
href="https://example.com"
underline="hover"
>
_includeNewTabIcon
</Link>
<Link
_newTab
_includeNewTabIcon
href="https://example.com"
underline="none"
>
_includeNewTabIcon
</Link>
</Stack>
</Stack>Props
| Prop | Required | Default | Type and notes |
|---|---|---|---|
href | - | | |
underline | - | "always" | It is important to indicate that links are clickable. Underlining is a popular way of achieving this goal, but there are many others. The best approach will depend on the context. See Beyond Blue Links: Making Clickable Elements Recognizable for more information. |
inPageLink | - | false | See Anchors OK? Re-Assessing In-Page Links from Nielsen Norman Group. |
_newTab | - | false | Sets Note: Despite being relatively commonly seen on the web, it is generally inadvisable to do this. See Opening Links in New Browser Windows and Tabs. |
_includeNewTabIcon | - | false | When _newTab is true, if _includeNewTabIcon is also true, there will be an icon at the end of the text indicating that the link will open in a new tab. |
children | - | | |
...rest | - | - | See the docs for rest parameters. For Link, you could pass anything you normally would pass to <a> because the return value looks something like this: |