external
boolean
Indicates that the link goes to an external site
If no href
is passed the link will be rendered as a <button>
element. The onClick
prop can be passed to handle its click behaviour.
<Link onClick={function noRefCheck() {}}>I'm a button that looks like a link</Link>
<Link>
supports being rendered at different sizes with the icons changing accordingly. Note that size
will be ignored if <Link>
is inline
.
<StackalignItems="flex-start"gap="8px"><Link size="lg">Large</Link><Link size="md">Medium</Link><Link size="sm">Small</Link><Link size="xs">Extra small</Link><Link>Constant</Link></Stack>
If the link will sit within a body of copy, you can use inline
to indicate this and no accompanying icons will be rendered. Note that the size
prop will be ignored if the link is marked as inline so it can blend in with its surrounding copy.
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our reliance on science and trusted medical information.
<Text>Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our{' '}<Linkhref="/"inline>reliance on science</Link>{' '}and trusted medical information.</Text>
An inline
link that wraps to multiple lines.
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our reliance on science and trusted medical information.
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our reliance on science and trusted medical information.
<Stack gap="8px"><Text>Elsevier Health sees a bright future for global health. And it's a future that{' '}<Linkhref="/"inline>we're building together. Where we unite in our reliance on science and trusted medical information.</Link>{' '}</Text><Text>Elsevier Health sees a bright future for global health. And it's a future that{' '}<Linkexternalhref="/"inline>we're building together. Where we unite in our reliance on science and trusted medical information.</Link>{' '}</Text></Stack>
<Link>
can be marked as "external" to add a visual indication. rel="noopener"
will also be automatically added and the icon will come immediately after the last word.
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our inline external link inline external link inline external link inline external link inline external link inline external link and trusted medical information.
<Stack gap="8px"><Boxstyle={{maxInlineSize: '200px'}}><Linkexternalhref="/">I'm an External Link over multiple lines</Link></Box><Text>Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our{' '}<Linkexternalhref="/"inline>inline external link inline external link inline external link inline external link inline external link inline external link</Link>{' '}and trusted medical information.</Text></Stack>
startIcon
or endIcon
can be passed to the <Link>
components to add icons before or after the text. You can find a list of the available icons on the icons page. Icons will scale according to the link's sizes, the icons will be vertically centered to link content.
<StackalignItems="flex-start"gap="8px"><LinkendIcon={<ChevronRightIcon />}href="/"startIcon={<LockOpenIcon />}>I'm a link with icons</Link><LinkendIcon={<ChevronRightIcon />}href="/"size="lg"startIcon={<LockOpenIcon />}>I'm a link with icons</Link></Stack>
A centerIcons
boolean can be passed that will take priority over the external
prop for centering icons, the icons will be vertically centered to link content.
<Boxstyle={{maxInlineSize: '380px'}}><LinkcenterIconsendIcon={<ChevronRightIcon />}externalhref="/"size="lg"startIcon={<ChevronLeftIcon />}>I'm a link with center-ised icons on multiple lines</Link></Box>
A rightAlignEndIcon
boolean can be passed that will take priority over the external
prop, the end icon will be vertically aligned to the right of the link content.
<Box><LinkendIcon={<ChevronRightIcon />}externalhref="/"rightAlignEndIconsize="lg"startIcon={<ChevronLeftIcon />}>I'm a link with a right-aligned end icon</Link></Box>
Pass null
as value for endIcon
to overwrite the default and don't render an icon.
A more complex example of a group of links horizontally aligned with each other
Feedback on new experienceTell us what you thinkopens in new tab/window
<Boxatoms={{backgroundColor: 'global-default',paddingBlock: '12px'}}theme="dark"><FlexalignItems="center"direction="row"gap="4px"justifyContent="space-between"><LinkendIcon={null}href="/"size="xs"startIcon={<ChevronLeftIcon />}>Return to old experience</Link><Text size="xs"><Boxas="span"atoms={{display: {desktop: 'inline-block',mobile: 'none'},marginInlineEnd: '4px'}}>Feedback on new experience</Box><Linkhref="/"inlinetarget="_blank">Tell us what you think<ue>opens in new tab/window</ue></Link></Text></Flex></Box>
An inline
link can also render an endIcon
and behave as other links variants.
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our Download
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our External Download
<Stack gap="8px"><LinkendIcon={<DownloadIcon />}href="/"inline>Download</Link><Text>Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our{' '}<LinkendIcon={<DownloadIcon />}href="/"inline>Download</Link></Text><Text>Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our{' '}<LinkendIcon={<DownloadIcon />}externalhref="/"inline>External Download</Link></Text></Stack>
visuallyHiddenContent
can be passed that will add the content inside a <VisuallyHidden>
component after the link content.
Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our inline external link inline external link inline external link inline external link inline external link inline external link end icon should never be an orphan inside a line
<Text>Elsevier Health sees a bright future for global health. And it's a future that we're building together. Where we unite in our{' '}<LinkendIcon={<DownloadIcon />}externalhref="/"inlinevisuallyHiddenContent="end icon should never be an orphan inside a line">inline external link inline external link inline external link inline external link inline external link inline external link</Link></Text>
external
boolean
Indicates that the link goes to an external site
centerIcons
boolean
visuallyHiddenContent
ReactNode
If there is any visually hidden content, it should go here rather than in children
inline
boolean
Indicates if link is used in line with other text content.
Default: false
startIcon
ReactNode
The startIcon property allows an icon to be passed which is displayed before the link text.
endIcon
ReactNode
The endIcon property allows an icon to be passed which is displayed after the link text.
size
TextSize
The rightAlignEndIcon property allows an icon to be passed which is displayed right aligned after the link text.
rightAlignEndIcon
boolean
atoms
Applies permitted design system styles. See styling documentation for more.