Hyperlink
Hyperlinks take users somewhere else in the app, or a different site.
Component Type
Button
Platform
Web
Component
Sana Canvas
Delivery Channels
Web
Version
16.1.7Experience Surfaces
Page Body Inline
Anatomy

- Text: Describes where the link goes.
- Underline (conditional): Appears when the link is inline with body text.
- External link icon (conditional):
extLinksystem icon that appears when the link navigates to a different site entirely.
Usage Guidance
Hyperlinks (also known as links) are interactive elements that navigate somewhere else, such as another page, or a different site entirely. Links may also act as anchor tags that navigate to users to sections on the same page, like in a table of contents.
Hyperlinks may appear inline with body text or as a standalone link. When a hyperlink is used inline with body text, an underline is used to differentiate it from surrounding text to avoid relying on color alone to communicate interactivity.
When to Use
- Use a Hyperlink to navigate to a different page or view within the app
- Use an External Hyperlink to navigate to a different site entirely. External Hyperlinks are
indicated by an
extLinksystem icon placed at the end. - Hyperlinks may be used as anchor tags to navigate to different sections on a page.
- Use a standalone Hyperlink when you need to place a Hyperlink outside of a paragraph or body text. This will remove the underline.
When to Use Something Else
- Use a Button for any action that changes state or triggers a process or workflow.
- Use Tabs to organize and switch between related sections on the same page. Tabs hide content to preserve screen real estate.
- Use Breadcrumbs to expose and navigate a hierarchy of pages.
Examples
Hyperlink
Hyperlinks should be used when you want to navigate away from the current page or to an anchor on
the current page. By default, Hyperlinks have an underline for accessibility.
import {Hyperlink} from '@workday/canvas-kit-react/button';
export default () => <Hyperlink href="#hyperlink">Hyperlink</Hyperlink>;
Inverse
Hyperlinks also have an inverse variant. Use this variant when you need to place a Hyperlink
on a dark background.
import React from 'react';
import {Hyperlink} from '@workday/canvas-kit-react/button';
import {Box} from '@workday/canvas-kit-react/layout';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const parentContainerStyles = createStyles({
backgroundColor: system.color.brand.accent.primary,
padding: system.padding.md,
display: 'inline-flex',
gap: system.gap.md,
});
export default () => (
<Box cs={parentContainerStyles}>
<Hyperlink href="#hyperlink" variant="inverse">
Hyperlink
</Hyperlink>
<Hyperlink href="#hyperlink" variant="inverse" linkType="standalone">
Hyperlink
</Hyperlink>
</Box>
);
Secondary
Hyperlinks also have a secondary variant. This is a dark gray alternate to the default blue
hyperlink. Use this variant when you need to place a Hyperlink on a colored background.
import {Hyperlink} from '@workday/canvas-kit-react/button';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const containerStyles = createStyles({
backgroundColor: system.legacy.color.surface.info.default,
padding: system.padding.md,
display: 'inline-flex',
gap: system.gap.md,
});
export default () => (
<div className={containerStyles}>
<Hyperlink variant="secondary" href="#secondary-hyperlink">
Hyperlink
</Hyperlink>
</div>
);
Standalone
Use linkType="standalone" when you need to place a Hyperlink outside of paragraph or body text,
such as in a button group or navigation list. This removes the underline. By default, linkType is
"inline" and links are underlined.
import {ExternalHyperlink, Hyperlink} from '@workday/canvas-kit-react/button';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const containerStyles = createStyles({
display: 'inline-flex',
gap: system.gap.md,
});
export default () => (
<div className={containerStyles}>
<Hyperlink linkType="standalone" href="#standalone-hyperlink">
Hyperlink
</Hyperlink>
</div>
);
Accessibility Note: Only use
linkType="standalone"when something other than color already shows it’s a link — for example, it’s set apart from surrounding content, like in a button or navigation list. Never uselinkType="standalone"for links embedded in body copy; a hover-only underline is not enough for inline links to meet WCAG v2.2 success criterion 1.4.1 Use of Color .
In Body Text
In most cases use Hyperlink and ExternalHyperlink with the default linkType="inline" in body
text of a sentence where you need to link to another page or part of the document. By default they
will wrap to a new line.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit involuptate velit esse cillum dolore eu fugiatnulla pariatur.
import {Hyperlink} from '@workday/canvas-kit-react/button';
export default () => (
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
<Hyperlink href="#hyperlink">tempor incididunt</Hyperlink> ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in
<Hyperlink href="#hyperlink">voluptate velit esse cillum dolore eu fugiat</Hyperlink>
nulla pariatur.
</p>
);
Accessibility Note: Underlining links is not required in most cases. However, the example above is one such exception. When hyperlinked text appears inline with static text, a text decoration is required to avoid failing WCAG v2.2 success criterion 1.4.1 Use of Color . Do not use
linkType="standalone"here, as removing the underline would fail this criterion.
Accessibility
Our link components render semantic HTML <a> elements to the browser DOM. This means that ARIA
roles won’t be necessary in most cases. The href prop is required for accessibility. Activation
links with the Enter key is standard expected behavior, while Space is only expected for buttons.
When to Use Links vs Buttons
- Use Hyperlinks when: Navigating to different pages or sections, or changing the browser’s location
- Use Buttons when: Performing actions like submitting forms, opening modals, or triggering functions without navigation
- Why This Matters: Screen reader users expect different behaviors from links vs buttons. Users navigate between links using different keyboard shortcuts than buttons. Browser behaviors like “Open in new tab” only work with proper links.
Common Mistakes to Avoid
- Using buttons styled as links for navigation (breaks right-click context menus)
- Using links for actions like “Delete” or “Save” (confuses user expectations)
- Missing
hrefattributes on navigation elements (breaks keyboard accessibility) - Using
href="#"withonClickhandlers instead of proper buttons
Component API
Props
Props extend from a. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
variant | 'inverse' | 'secondary' | Sets color styles for Hyperlink
| |
linkType | 'inline' | 'standalone' | Sets underline behavior for Hyperlink
| 'inline' |
href | string | Attribute for the hyperlink URL | |
children | ReactNode | ||
cs | | The | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | a |
ref | React.Ref<R = a> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
ExternalHyperlink
If your link should open in a new tab or window use the ExternalHyperlink component. It will let
users know about the behavior by adding an icon, externalLinkIcon.
Accessibility Note: Providing a label to the icon via the
iconLabelprop is required for accessibility because the icon adds meaning to the link text. We recommend keeping the alt text as concise as possible, such as “Opens new window”. This override will be needed for translations.
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
export default () => (
<ExternalHyperlink href="https://workday.com" iconLabel="Opens new globalThis">
External Hyperlink
</ExternalHyperlink>
);
ExternalHyperlinks also have an inverse variant. Use this variant when you need to place the
link on a dark background.
import React from 'react';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
import {Box} from '@workday/canvas-kit-react/layout';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const parentContainerStyles = createStyles({
backgroundColor: system.color.brand.accent.primary,
padding: system.padding.md,
display: 'inline-flex',
gap: system.gap.md,
});
export default () => (
<Box cs={parentContainerStyles}>
<ExternalHyperlink
href="https://workday.com"
variant="inverse"
iconLabel="Opens link in new globalThis"
>
Hyperlink
</ExternalHyperlink>
<ExternalHyperlink
href="https://workday.com"
variant="inverse"
linkType="standalone"
iconLabel="Opens new globalThis"
>
Hyperlink
</ExternalHyperlink>
</Box>
);
ExternalHyperlinks will also flip the icon for right-to-left (RTL) languages.
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
export default () => (
<CanvasProvider theme={{canvas: {direction: ContentDirection.RTL}}}>
<ExternalHyperlink href="https://workday.com" iconLabel="Opens link in new globalThis">
השועל החום המהיר קופץ מעל הכלב העצל
</ExternalHyperlink>
</CanvasProvider>
);
Component API
Props
Props extend from a. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
iconLabel | string | Informs a screen reader user the link will open in a new globalThis. It is read after the link text. This value will need to be translated. | |
variant | 'inverse' | 'secondary' | Sets color styles for Hyperlink
| |
linkType | 'inline' | 'standalone' | Sets underline behavior for Hyperlink
| 'inline' |
href | string | Attribute for the hyperlink URL | |
children | ReactNode | ||
cs | | The | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | a |
ref | React.Ref<R = a> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |