Link
A link enables users to navigate to a different page, page section, or site.
#Examples
The link component features various properties for adjusting its appearance. The following sections showcase these properties and explain when to use them.
#Default
Use the link's default appearance when it's presented by itself. That is, when it's not part of a sentence or a phrase. It features an arrow to indicate that it's a link without relying on color alone.
<Link href="https://www.google.com">Medium standalone link (default)</Link>
#Size
Use this property to adjust how attention-grabbing a standalone link should be.
<Link href="https://www.google.com" size="small">
Small standalone link
</Link>
<br />
<Link href="https://www.google.com" size="medium">
Medium standalone link (default)
</Link>
<br />
<Link href="https://www.google.com" size="large">
Large standalone link
</Link>
<br />
#Inline
Use this variant when the link is part of a sentence or a phrase. It features an underline, instead of an arrow, to indicate without color that it is a link. This variant inherits its size from the text it's part of.
This is an example of an inline link, which is part of a sentence.
<Paragraph>
This is an example of an{" "}
<Link href="https://www.google.com" inlineInText>
inline link
</Link>
, which is part of a sentence.
</Paragraph>
#Unstyled
Use this property when an interface element, such as an image, needs to behave like a link, but should not be styled like a standalone or inline link. Its custom styling and the UI context in which it's used should make clear that it's a link and where it links to.
#Open in new tab or window
When a link points to a page on another domain, it's generally best to open it in a new tab or window (depending on the user's browser setting). This can be achieved by setting the openNew
property to true
.
<Link href="https://www.google.com" openNew>
Medium standalone link (default)
</Link>
Property | Description | Defined | Value |
---|---|---|---|
hrefRequired | string Url of the page the link redirects to | ||
openNewOptional | boolean Opens the link in a new tab if set to true | ||
childrenOptional | element Label for the link | ||
onClickOptional | function Callback for onClick events | ||
inlineInTextOptional | boolean Renders the link inline if set to true, should be used when the link is part of a text block | ||
unstyledOptional | boolean Renders the link without style if set to true | ||
sizeOptional | "large" | "medium" | "small" Size of the link, defaults to `"medium"` | ||
aria-labelOptional | string Screen reader text for the link | ||
disableWordBreakOptional | boolean When link is wrapped into single words | ||
data-observe-keyOptional | string Unique string, used by external script e.g. for event tracking | ||
classNameOptional | string Custom className that's applied to the outermost element (only intended for special cases) | ||
styleOptional | object Style object to apply custom inline styles (only intended for special cases) | ||
tabIndexOptional | number Tab index of the outermost HTML element of the component | ||
onKeyDownOptional | function Callback for onKeyDown event | ||
onMouseDownOptional | function Callback for onMouseDown event | ||
onMouseEnterOptional | function Callback for onMouseEnter event | ||
onMouseLeaveOptional | function Callback for onMouseLeave event | ||
onFocusOptional | function Callback for onFocus event | ||
onBlurOptional | function Callback for onBlur event |
#Guidelines
#Best practices
#Do not use when
#Accessibility
Explore detailed guidelines for this component: Accessibility Specifications