Link

Links are used as navigational elements. They may appear isolated, inside a sentence or paragraph or following the content.

Props

NameTypeDescriptionDefault
disabledbooleanIf true, the link is disabled.false
inheritColorbooleanIf true, the color is inherited from parent.false
iconstring | (React.ReactNode & React.SVGProps <SVGSVGElement>)Material Symbol name or SVG element as the icon that will be placed next to the link text. When using Material Symbols, replace spaces with underscores. By default they are outlined if you want it to be filled prefix the symbol name with "filled_".-
iconPosition'before' | 'after'Indicates the position of the icon in the component.'before'
hrefstringPage to be opened when the user clicks on the link.-
newWindowbooleanIf true, the page is opened in a new browser tab.false
onClick() => voidIf defined, the link will be displayed as a button. This function will be called when the user clicks the link.-
Required
children
stringText of the link.-
margin'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | MarginSize of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.-
tabIndexnumberValue of the tabindex attribute.0

Examples

Basic usage

There are many React based routers, unfortunately all with different APIs.

So we decided to make our link component just an styled HTML anchor element which allows it to be used in any React based router. For each API is different, so here are some examples for React Router and NextJS Link. Some of these examples are just representations of how they should be implemented but might not work correctly in this scenario.

This is an example of React Router using the prop component. Note that this prop is not available in v6.

In React Router v6 the prop component is no longer available so it is necessary to use hooks provided by React Router v6.

This is an example of NextJS .

Icons