Use Link...
- To navigate the user to a new page.
- To navigate the user to a different section of the same page.
- To change the URL.
- To cause a browser redraw/refresh.
- To download a linked resource.
Don't use Link...
- To perform actions other than navigation; use Button for this instead. This includes:
- to trigger an action in the system
- to prompt the user to perform an action
- to confirm an action
- to draw attention to important actions
- To provide same-page navigation that requires a persistent navigation element as the user scrolls. Use Anchor Bar instead.
The preview has been updated.
Width
Use width="full-width"
to make the link fill its container instead of being inline.
The preview has been updated.
Skins
CTA
Use as a call-to-action in Standard Tile or Banner.
Use skin="cta"
to position the arrow to the right of the text.
The preview has been updated.
Use skin="cta-left"
to position the arrow to the left.
The preview has been updated.
Inside a block of Typography that sets the text
color to white, the CTA link automatically changes its icon to white
The preview has been updated.
Unstyled
- This variant removes the normal link styling, such as color and underline.
- Only use it with something that provides its own affordance (that is, something that shows a hover and active state). Otherwise, users won’t have a way to know it’s clickable.
- A link with the
unstyled
skin won't show up with normal link styling, although it still gets the "pointer" cursor on hover.
The preview has been updated.
Covering
Use covering
to increase the clickable target of a Link to cover the nearest ancestor element that has positioning context. This is usually a Standard Tile or a Card with skin="link"
.
Only wrap the Link around the content that should be included in the accessible name, which is usually the title or call-to-action.
The preview has been updated.
Use skin="unstyled"
to remove the normal link styling.
The preview has been updated.
With icon
withIconSeparated
is deprecated in SWAN v3.3
Replace it with withIcon
which behaves the same.
- The "link with icon" feature is a link that has both text and an image or icon, and vertically centers both sub-elements.
- "Link with icon" can contain any type of image or icon.
- "CTA link" uses specific text styling and only uses the Arrow icon.
The preview has been updated.
As a Button
Use render
for Links with the behavior of a Button. Refer to render guidelines.
Links that perform an action on the current page should render a <button>
instead of an <a>
for accessibility requirements.
The preview has been updated.
Button as a Link
Use render
for Buttons with the behavior of a Link. Refer to render prop guidelines.
Buttons that take users to a new page should render an <a>
instead of a <button>
for accessibility requirements.
The preview has been updated.
Global Link Component
Some routing frameworks, like Gatsby, Next, or TanStack Router, suggest using their own Link
component for routing. While that can be done at the component level using the as
or render
props, it can also be configured within SwanProvider. For more information, see the SwanProvider setup docs.