Link

The Link component allows you to easily customize anchor elements with your theme colors and typography styles.

Quiet

When the surrounding context implies this is a link (i.e. in a list, menu or navigation), the quiet version may be used.

<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='primary' context='quiet'>
Primary (Quiet)
</Link>
<br />
<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='dark' context='quiet'>
On dark background : Primary (Quiet)
</Link>
<br />
<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='secondary' context='quiet'>
Secondary (Quiet)
</Link>
<br />
<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='name' context='quiet'>
Name (Quiet)
</Link>
<br />

Explicit

When a link doesn’t have surrounding context making it clear that it is a link, then for the most accessible experience, the explicit version should be used.

<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='primary' context='explicit'>
Primary (Explicit)
</Link>
<br />
<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='dark' context='explicit'>
On dark background : Primary (Explicit)
</Link>
<br />
<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='secondary' context='explicit'>
Secondary (Explicit)
</Link>
<br />
<Link href="#" onClick={(e) => e.preventDefault()} linkVariant='name' context='explicit'>
Name (Explicit)
</Link>

Props

PropTypeDefaultDescription
childrennodeThe content of the link.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
color'success' | 'info' | 'warning' | 'error''info'The color of the link, only useable with variant="button"
componentelement type'a'The component used for the root node. Either a string to use a HTML element or a component. ⚠️ Needs to be able to hold a ref.
TypographyClassesobjectclasses prop applied to the Typography element.
underline'none' | 'hover' | 'always''hover'Controls when the link should have an underline.
variant'button''link'Applies the theme typography styles.
linkVariant'primary' | 'secondary' | 'dark' | 'name''primary'Applies the Link styles.
context'quiet' | 'explicit''quiet'Defines the context of the link.
typestringSpecifies the type of the link.
hrefstringSpecifies the URL of the page the link goes to.
target'_blank' | '_self' | '_parent' | '_top''_self'Specifies where to open the linked document.
rel'alternate' | 'author' | 'bookmark' | 'external' | 'help' | 'license' | 'next' | 'nofollow' | 'noreferrer' | 'noopener' | 'prev' | 'search' | 'tag'Specifies the relationship between the current document and the linked document.
tostringSpecifies the destination of the link. This is useful when using routing libraries like react-router.
onClickfunctionSpecifies the script to be run when a click event occurs.
sxobject{}The sx prop lets you style elements inline, using a style object that is picked up by the system.
cssobject{}The css prop lets you style elements inline, using a style object.
idstringThe id of the element.
keystring | numberThe key of the element. This is useful in lists for performance reasons.
passHrefbooleanfalseAllows the href to be passed to the child component.
data-testidstringdata-testid added to the root element of the component
aria-labelstringThe aria-label attribute defines a string value that labels an interactive element.
aria-labelledbystringIdentifies the element (or elements) that labels the element it is applied to.
aria-describedbystringIdentifies the element (or elements) that describes the element on which the attribute is set.
onMouseOverfunctionSpecifies the script to be run when a mouse goes over the element.
onMouseLeavefunctionSpecifies the script to be run when a mouse leaves the element.
rolestringSpecifies the role of the link.
tabIndexnumberSpecifies the tab order of the link.
downloadbooleanfalseSpecifies that the target will be downloaded when a user clicks on the hyperlink.