Skip to main content

Link Ready

Links are used in content paragraphs to create pathways from one page to another. If you need a link with semi bold font-weight and/or icon, please use Button component instead.

Examples #

Properties #

Property Attribute Description Type Default
accessibleExpanded accessible-expanded If a button expands or collapses adjacent content, then use the ariaExpanded prop to add the aria-expanded attribute to the button. Set the value to convey the current expanded (true) or collapsed (false) state of the content. Only works with empty url. boolean undefined
accessibleLabel accessible-label Adds accessible label for the link that is only shown for screen readers. Typically, this label text replaces the visible text on the link for users who use assistive technology. string undefined
accessibleLabelDownload accessible-label-download Adds accessible label for tooltip that is shown in external link (url & external have both been set) string getLocaleString(this.accessibleLabelDownloadDefaults)
accessibleLabelDownloadDefaults accessible-label-download-default Defaults for accessibleLabelDownload DuetLangObject | string DuetStringsDownloadLinkDefaults
accessibleLabelExternal accessible-label-external Adds accessible label for tooltip that is shown in external link (url & external have both been set) string getLocaleString(this.accessibleLabelExternalDefaults)
accessibleLabelExternalDefaults accessible-label-external-default Defaults for accessibleLabelExternal DuetLangObject | string DuetStringsExternalDefaults
accessiblePopup accessible-popup Use this property to add an aria-haspopup attribute to a button. Only works with empty url. string "false"
download download Causes the browser to treat the linked URL as a download. Can be used with or without a filename value. With a value, it will be used as the name for the downloaded file. Without a value, the browser will suggest a name. NOTE: this attribute only works for same-origin URLs, or the blob: and data: schemes. string null
external external Forces URL to open in a new browser tab. Used together with URL prop. boolean false
icon icon Icon to display on the left side of the link text (only with "block" and "button" variations) string undefined
iconBackground icon-background Color of the icon to display (only with "button" variation) string null
iconColor icon-color Color of the icon to display (only with "block" and "button" variations) string "currentColor"
iconResponsive icon-responsive Whether the icon changes its size responsively (only with "block" variation) boolean false
identifier identifier Adds a unique identifier for the link. Please note that with this particular component this id is added inside Shadow DOM. If you need an id on the html element, use regular id attribute instead. string undefined
language language [DEPRECATED] this is now handled via the html lang tag, and is no longer used - kept to avoid breaking changes and ease unit testing

The currently active language. This setting changes the external link accessible label to match the chosen language.
"en" | "fi" | "sv" getLanguage()
margin margin Controls the margin of the component (only with "button" variation) "auto" | "none" "auto"
padding padding Controls the padding of the component (only with "block" variation) "auto" | "none" "auto"
tabToLink tab-to-link Initially visually hidden link, which is shown on focus. boolean false
theme theme Theme of the button. "" | "default" | "turva" ""
url url A destination to link to, rendered in the href attribute of a link. string "#"
variation variation Style variation of the link. "block" | "button" | "default" "default"

Methods #

setFocus(options?: FocusOptions) => Promise<void> #

Sets focus on the specified duet-link. Use this method instead of the global
link.focus().

Parameters #

Name Type Description
options FocusOptions

Returns #

Type: Promise<void>

Shadow Parts #

Part Description
"block-chevron" piercing selector for styling the block chevron
"duet-link" piercing selector for styling the link
"duet-link-content" piercing selector for styling the link content wrapper

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • For navigation where the link appears within or following a sentence. Like this link here.
  • When you need to link to another page.

When not to use #

  • For interface actions that aren’t links to other views in the app. Use button instead.
  • When you need to provide a call-to-action for the user. Use button instead.
  • For form submit, cancel, edit, save and opening a modal. Use button instead.

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.

Integration guidelines


Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.