Skip to main content

What are you looking for?

Try searching for…

Components

Link

Link is clickable text or graphics that take the user to other pages or documents.

HTML

Press Enter to start editing
Unable to parse html
const PreviewEn = () => {
  const rand = useId();
  return (
    <Link href={'/en/patterns/external-links/' + rand}>Labelling links</Link>
  );
};

render(<PreviewEn />)

Usage

The component is an <a> element, and on MDN Web Docs you can read more about the anchor HTML tag (mozilla.org). Use the class name ds-link on an <a> element to apply the link style.

CSS variables and data attributes

Sizes are controlled with data-size and colors with data-color. The component will inherit from the closest parent where these are set.

CSS Variables
NameValue
--dsc-link-colorvar(--ds-color-text-subtle)
--dsc-link-color--hovervar(--ds-color-text-default)
--dsc-link-color--activevar(--ds-color-text-default)
--dsc-link-color--visitedvar(--dsc-link-color)
--dsc-link-background--activetransparent
--dsc-link-text-decoration-thickness--hover0.125em
--dsc-link-text-decoration-thickness0.0625em
--dsc-link-border-radius0

No relevant data attributes found.

React

children
Description

The content to display inside the link.

Type
ReactNode
asChild
Description

Change the default rendered element for the one passed as a child, merging their props and behavior.

Type
boolean
Default
false
NameTypeDefaultDescription
childrenReactNode-

The content to display inside the link.

asChildbooleanfalse

Change the default rendered element for the one passed as a child, merging their props and behavior.

Edit this page on github.com (opens in a new tab)