OTTODesign System

Components

Link

Links serve as navigational elements that assist users to move within a page, to a different page on the same website, or to external websites and resources.

Configurator

LiveLink: inverted variants belong on dark grounds, switch the scheme to Dark to try them.
HTML
<oc-link-v2><a href="#">Alle Angebote</a></oc-link-v2>

Usage

Variants

These are the following variants of a Link:

  • Primary Links are used for the most important links on a page or for inline links.
  • Secondary Links are intended for less important links on a page. Be careful when using them as they have a lower click affordance compared to primary links.
  • Sale Links are used for content that is used in the context of a sale, for example, 'Sale' categories in the navigation menu.
  • Underlined Links are only placed on light colored backgrounds. They come in regular and bold.
  • Inverted Links are only placed on dark backgrounds. They come in regular and bold.

underlined

Alle Angebote

underlined-bold

Alle Angebote
LivePrimary, secondary, underlined regular, and underlined bold links
HTML
<p class="demo-label">primary</p><oc-link-v2><a href="#">Alle Angebote</a></oc-link-v2></div>
<p class="demo-label">secondary</p><oc-link-v2 variant="secondary"><a href="#">Hilfe &amp; Kontakt</a></oc-link-v2></div>
<p class="demo-label">sale</p><oc-link-v2 variant="sale"><a href="#">Zum Sale</a></oc-link-v2></div>
<p class="demo-label">underlined</p><oc-link-v2 variant="underlined"><a href="#">Alle Angebote</a></oc-link-v2></div>
<p class="demo-label">underlined-bold</p><oc-link-v2 variant="underlined-bold"><a href="#">Alle Angebote</a></oc-link-v2></div>

inverted-bold

Alle Angebote
LiveInverted and inverted bold
HTML
<p class="demo-label" style="color:#fff">inverted</p><oc-link-v2 variant="inverted"><a href="#">Alle Angebote</a></oc-link-v2></div>
<p class="demo-label" style="color:#fff">inverted-bold</p><oc-link-v2 variant="inverted-bold"><a href="#">Alle Angebote</a></oc-link-v2></div>

For standalone links, a larger link size may be used, while smaller sizes may be suitable for less important navigation elements.

Links are available in the following sizes:

LiveLink 125, link 100, link 75 and link 50
HTML
<oc-link-v2 size="125"><a href="#">Alle Angebote</a></oc-link-v2>
<oc-link-v2 size="100"><a href="#">Alle Angebote</a></oc-link-v2>
<oc-link-v2 size="75"><a href="#">Alle Angebote</a></oc-link-v2>
<oc-link-v2 size="50"><a href="#">Alle Angebote</a></oc-link-v2>

You can also add an Icon to the left or right of the Link. Icons are optional and can be placed on either side of the Link. They visually communicate the Link's target and enhance user attention. Left-side Icons help reduce cognitive load by symbolizing the Link's action. Icons on the right are used as affordance for the interaction; for example, a leaving-page denotes an external target.

Link 100 and link 125 use icons in size 100, while link 75 and link 50 use icons in size 50.

Icon right

Zum Hersteller
LiveIcon left and right
HTML
<p class="demo-label">Icon right</p><oc-link-v2 size="125" icon-right="leaving-page"><a href="#" target="_blank" rel="noopener">Zum Hersteller</a></oc-link-v2></div>
<p class="demo-label">Icon left</p><oc-link-v2 icon-left="smiley-positive"><a href="#">Bewertung schreiben</a></oc-link-v2></div>

Behavior

States

Hover, press and tab through the links to see their states

LiveStates
HTML
<oc-link-v2><a href="#">Alle Angebote</a></oc-link-v2></div>
<oc-link-v2 variant="secondary"><a href="#">Alle Angebote</a></oc-link-v2></div>
<oc-link-v2 variant="sale"><a href="#">Zum Sale</a></oc-link-v2></div>
<oc-link-v2 variant="underlined"><a href="#">Alle Angebote</a></oc-link-v2></div>
<oc-link-v2 variant="underlined-bold"><a href="#">Alle Angebote</a></oc-link-v2></div>
<oc-link-v2 variant="inverted"><a href="#">Alle Angebote</a></oc-link-v2></div>
<oc-link-v2 variant="inverted-bold"><a href="#">Alle Angebote</a></oc-link-v2></div>

Fitting

The width of links fits the content.

LiveFit-content
HTML
<span style="background:rgba(229,0,107,.08);outline:1px dashed #e5006b"><oc-link-v2 size="125"><a href="#">Alles zu Lieferung und Versand</a></oc-link-v2></span>

Placement

Links can be placed in two ways: as stand-alone elements or inline within the surrounding text.

When inserting a link around continuous text, use the inline variant. This will underline the link, meeting WCAG Success Criterion 1.4.1 Use of Color. When using inline links, it is important to match the size of the link with the surrounding text. The technical size "inherit" may be used for that case.

Inline

Du kannst deine Bestellung kostenlos zurücksenden, innerhalb von 30 Tagen.

LiveStand-alone and inline link
HTML
<p class="demo-label">Standalone</p>
<oc-link-v2 size="125"><a href="#">Rücksendung anmelden</a></oc-link-v2>
<p class="demo-label">Inline</p>
<p class="oc-copy-125">Du kannst deine Bestellung <oc-link-v2 size="inherit"><a href="#">kostenlos zurücksenden</a></oc-link-v2>, innerhalb von 30 Tagen.</p>

If you are placing multiple standalone links next to each other, make sure there is a 16px horizontal and 8px vertical gap between them.

LiveHorizontal and vertical placing
HTML
<oc-link-v2 size="125"><a href="#">Damenmode</a></oc-link-v2><oc-link-v2 size="125"><a href="#">Herrenmode</a></oc-link-v2><oc-link-v2 size="125"><a href="#">Kindermode</a></oc-link-v2></div>
<oc-link-v2 size="125"><a href="#">Sneaker</a></oc-link-v2><oc-link-v2 size="125"><a href="#">Taschen</a></oc-link-v2><oc-link-v2 size="125"><a href="#">Schmuck</a></oc-link-v2></div>

Target

Links can have different targets. The three main types of link targets are:

  • Anchor Links direct users to a different section of the current page.
  • Internal Links navigate to a new page within the same website.
  • External Links direct users to an external website or file

Link: navigates

Zum Hersteller

Buttons: trigger actions

Zurück Weiter
LiveLink vs. button
HTML
<p class="demo-label">Link: navigates</p>
<oc-link-v2 size="125" icon-right="leaving-page"><a href="#" target="_blank" rel="noopener">Zum Hersteller</a></oc-link-v2>
<p class="demo-label">Buttons: trigger actions</p>
<oc-button-v1 variant="secondary">Zurück</oc-button-v1>
<oc-button-v1 variant="primary">Weiter</oc-button-v1>

A link directs the user away from their current journey for exploration or additional information. Links can be used to move within a page, to a different page on the same website or to external websites and resources.

Whereas a button keeps the user within their current journey or move them to the next or previous step in that journey. They often trigger actions that support completing a task, like submitting a form, confirming an action, changing content or loading new content without disrupting the flow.

Best practices

DoUse links thoughtfully and as few as possible.
Don'tOverwhelm users with too many distracting links, that might interrupt their journey.

Mehr zu Lieferzeiten findest du in unseren Versandinfos. Die Lieferung ist ab 29 € kostenlos.

DoUse inline Link when surrounded by continuous text.

Mehr zu Lieferzeiten findest du in unseren Versandinfos. Die Lieferung ist ab 29 € kostenlos.

CautionAvoid using the secondary inline Link when surrounded by continuous text because it is less visible.
DoUse underlined link on color.
Don'tUse primary or secondary link on color.
DoUse links with one line.
CautionAvoid line breaks within the same link. Otherwise it can be perceived as two separate links.

Achte beim Kauf auf das FSC®-Label.

DoUse bold text to highlight information.

Achte beim Kauf auf das FSC®-Label.

Don'tUnderline text that is not a link to highlight information.

Mehr dazu in unseren Versandinfos für deine Bestellung.

DoUse the same size for link and text.

Mehr dazu in unseren Versandinfos für deine Bestellung.

Don'tUse different size for link and text.
DoUse same link styles in the same context.
Don'tMix different link styles in the same context.

Content guidelines

DoUse specific labels that clearly convey the link's function or destination.
Don'tUse generic or vague labels, such as "Hier klicken", "Jetzt entdecken" or "Mehr erfahren".
DoKeep link labels short concise.
Don'tUse lengthy sentences with punctuation marks for the label.

Accessibility

Be aware, that link 50 and 75 have an undersized as per WCAG SC 2.5.8 Target Size. That means that they have to maintain enough spacing of 24px from the center of the target to adjacent links. For that reason they have to maintain 8px vertical spacing to each other and can not be used within other interactive elements like cards.

Every small link keeps a free 24 × 24px target area

CautionUse enough spacing for link 50 and 75 to maintain a dead space of 24×24px.
Don'tUse links within other interactive elements like cards.

Implementation

Live demo

Deine Rücksendung

Du hast 30 Tage Zeit, deine Bestellung kostenlos zurückzuschicken. Melde die Rücksendung in deinem Kundenkonto an und gib das Paket bei Hermes ab.

Rücksendung anmelden
LiveReal OTTO components, rendered by the OTTO component runtime
HTML
<div class="on-frame" style="margin:0;padding:24px">
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));gap:16px;max-width:880px;margin:0 auto;align-items:start">
<oc-block-v2><div style="display:grid;gap:12px">
  <p class="oc-headline-100">Deine Rücksendung</p>
  <p class="oc-copy-100">Du hast 30 Tage Zeit, deine Bestellung kostenlos zurückzuschicken. Melde die Rücksendung in <oc-link-v2 size="inherit"><a href="#">deinem Kundenkonto</a></oc-link-v2> an und gib das Paket bei Hermes ab.</p>
  <oc-link-v2 icon-right="arrow-right"><a href="#">Rücksendung anmelden</a></oc-link-v2>
</oc-block-v2>
<oc-block-v2><div style="display:grid;gap:12px">
  <p class="oc-headline-100">Hilfe &amp; Service</p>
  <div style="display:grid;gap:12px"><oc-link-v2 variant="secondary" icon-left="order-shipped"><a href="#">Wo ist meine Bestellung?</a></oc-link-v2><oc-link-v2 variant="secondary" icon-left="payment-invoice"><a href="#">Rechnung herunterladen</a></oc-link-v2><oc-link-v2 variant="secondary" icon-left="delivery-express"><a href="#">Versandkosten und Lieferzeiten</a></oc-link-v2><oc-link-v2 variant="secondary" icon-left="person-callcenter"><a href="#">Kontakt zum Kundenservice</a></oc-link-v2></div>
</oc-block-v2>

Code

Version Tag Status API
v2 <oc-link-v2> Stable LinkV2

API

The Link component provides a clickable text element with attributes for setting the URL, base64 encoded URL for SEO purposes, ARIA label for accessibility, and emitting a click event when interacted with. It can also behave as a button and trigger an action instead of navigating to a new page.

The native a tag is moved to the default slot for SEO purposes.

Attributes / properties
Attribute Type Default Required Description
variant
11 values"primary" | "secondary" | "sale" | "inverted" | "on-color" | "on-color-bold" | "over-color" | "over-color-bold" | "inverted-bold" | "underlined" | "underlined-bold"
"primary" no Sets the main styling of the link component.

Can be one of: primary, secondary, over-color, over-color-bold, inverted, inverted-bold. Deprecated: underlined, underlined-bold, on-color, on-color-bold.
size "50" | "100" | "75" | "125" | "inherit" "100" no Sets the font of the link component.
Can be one of: 50, 75, 100, 125 or inherit.

If you want to use the font size of the parent element, set the size attribute to inherit.
icon-left icon name undefined no Sets the left icon This applies only when a size attribute is set.

Note: inherit is not supported.
icon-right icon name undefined no Sets the right icon This applies only when a size attribute is set.

Note: inherit is not supported.
icon-gap string "var(--oc-semantic-spacing-relative-25)" no Sets the gap between the icons and the text content of the link. This applies only when at least one of the icons is set.
inline "true" | "false" no Sets the link to be inline. It renders with an underline in all states.

Note: This is automatically set to true if the link is used inside a p tag or is surrounded by text nodes.
href string undefined no Deprecated: Use an a tag in the default slot instead.

Visit SEO optimization techniques for more information.

Sets the link target of the link.
base64-href string undefined no Sets the base64 encoded link target of the link component. Use this attribute to prevent search engines from indexing the link target.
target "_blank" | "_self" | "_parent" | "_top" undefined no Sets the target attribute of the link.

Note Only applies when href or base64Href is set.
rel string undefined no Sets the rel attribute of the link.

Note Only applies when href or base64Href is set.
as-button boolean false no Determines if the link behaves as a button. Set to true to make the link behave as a button and trigger an action instead of navigating to a new page.
oc-aria-label string undefined no Sets the ARIA label of the link.

Note This attribute is not available when using an a tag in the default slot. Instead, use the aria-label attribute on the a tag in the default slot.
Slots
Slot Required Description
default yes Sets the content of the link component.
Events
Event Detail type Description
click PointerEvent Clicking the link or pressing the Enter or Space key while the link is focused triggers the click event. Use this event in case the as-button attribute is set to true.
oc-property-change OcLinkV2Events["oc-property-change"] Whenever a property value changes, this event triggers. Use this event to track all property changes within the component.

Refer to the Events documentation for more information.
oc-mount { component: string; } Fired when the component is mounted to the DOM. The event is fired when the onMount hook of the component is called by the runtime.
oc-unmount { component: string; } Fired when the component is unmounted from the DOM. The event is fired when the function returned by the onMount hook of the component is called by the runtime.
Methods
  • focus: () => void

    Calls the native focus() method on the underlying element.

    This is a convenience method that internally uses invoke("focus").

    Returns: void

    Example:

    const link = document.querySelector("oc-link-v2");
    link.focus();
    
  • click: () => void

    Calls the native click() method on the underlying element.

    This is a convenience method that internally uses invoke("click").

    Returns: void

    Example:

    const link = document.querySelector("oc-link-v2");
    link.click();
    
  • goto: () => void

    This is a shorthand function that combines three operations:

    1. Unmasks the link href (if it's base64-encoded)
    2. Focuses the link element
    3. Clicks the link element

    This method simulates a complete user interaction with the link. It is especially useful for testing masked links.

    Returns: void

    Example:

    const link = document.querySelector("oc-link-v2[base64-href]");
    link.goto();
    
  • unmask: () => void

    Calls the underlying unmasking function to decode and apply the base64-encoded href. This is used when the link is rendered with the base64-href attribute for SEO purposes. Normally, unmasking happens automatically on user interaction, but this method allows you to trigger it programmatically for integration testing or other scenarios.

    Returns: void

    Example:

    const linkElement = document.querySelector("oc-link-v2[base64-href]");
    
    // Unmask the link programmatically
    linkElement.unmask();
    
    // Now the href is accessible
    console.log(linkElement.href);
    
  • dispatch: <E extends Event>(event: E) => void

    Calls dispatchEvent on the underlying element to dispatch the given event. This is useful for testing purposes, to simulate user interactions or to trigger custom events on the underlying element.

    Parameters:

    • event: E The event to dispatch on the underlying element

    Returns: void

    Example:

    const linkElement = document.querySelector("oc-link-v2");
    
    // Dispatch a custom event
    const customEvent = new CustomEvent("custom-action", {
      detail: { action: "track-click" },
    });
    linkElement.dispatch(customEvent);
    
    // Dispatch a native event
    const mouseEvent = new MouseEvent("mouseenter");
    linkElement.dispatch(mouseEvent);
    
  • invoke: <R>(methodIdentifier: string, ...args: unknown[]) => R

    Genric helper method used to invoke (call) functions on the underlying element which currently acts as link in the link component. This is useful in cases where there is no light dom element of the state of the link is not deterministic.

    The method will invoke the function on either a light dom link. element if it exists, or on the underlying element inside shadow dom in cases there is no light dom anchor.

    The result of the method depends on the implementation of the underlying element and must be assured by the consumer of the component.

    If there is no suitable element or method to invoke, it will return undefined. This function will only produce errors if the underlying method throws an error.

    The function will not throw if the invocation is not possible.

    Parameters:

    • methodIdentifier: string The name of the method to invoke on the underlying element
    • args: unknown[] The arguments to pass to the method

    Returns: R The result of the method invocation, or undefined if the element or method does not exist

CSS custom properties
Custom property Default Description
--icon-gap "var(--oc-semantic-spacing-relative-25)" Sets the gap between the icons and the text content of the link. This applies only when at least one of the icons is set.

Examples

Listed below are the most common variations of the link component as well as specific component variations for different use cases.

Inline

The inline attribute allows the link to be rendered inline with a decorative underline.

Du kannst deine Bestellung innerhalb von 30 Tagen kostenlos zurücksenden. Wo dein Paket gerade ist, siehst du unter Meine Bestellungen. Fragen beantwortet dir gern unser Kundenservice.

Alle Infos zur Rücksendung
HTML
<div style="display: flex;  gap: 16px;">
<div style="max-width: 456px; border: 1px solid #ccc; padding: 16px;">
  <span class="oc-copy-100">Du kannst deine Bestellung innerhalb von 30 Tagen kostenlos <oc-link-v2 size="inherit" inline="true">zurücksenden</oc-link-v2>. Wo dein Paket gerade ist, siehst du unter <oc-link-v2 size="inherit" inline="true">Meine Bestellungen</oc-link-v2>. Fragen beantwortet dir gern unser <oc-link-v2 size="inherit" inline="true">Kundenservice</oc-link-v2>.</span>
<br />
<oc-link-v2 size="inherit"
>Alle Infos zur Rücksendung</oc-link-v2
>
With button behavior

Variation of the default configuration using the as-button attribute to trigger an action when clicked instead of navigating to a new page.

Link
HTML
<oc-link-v2 as-button>Link</oc-link-v2>

The link component as a masked link. Search engines will not detect the href.

Link
HTML
<oc-link-v2 base64-href="Iw==">Link</oc-link-v2>

Variation link size inherit using the size attribute with the value inherit. This will use the font size of the parent element.

HTML
<h1 class="oc-headline-300">
<oc-link-v2 size="inherit" style="display: block"><a href='#'>Link within a headline</a></oc-link-v2>
</h1>

Demo with inline links.

Du kannst deine Bestellung innerhalb von 30 Tagen kostenlos zurücksenden. Wo dein Paket gerade ist, siehst du unter Meine Bestellungen. Fragen beantwortet dir gern unser Kundenservice.

Du kannst deine Bestellung innerhalb von 30 Tagen kostenlos zurücksenden. Wo dein Paket gerade ist, siehst du unter Meine Bestellungen. Fragen beantwortet dir gern unser Kundenservice.

HTML
<div style="display: flex;  gap: 16px;">
<div style="max-width: 456px; border: 1px solid #ccc; padding: 16px;">
  <p class="oc-copy-100">Du kannst deine Bestellung innerhalb von 30 Tagen kostenlos <oc-link-v2 size="inherit">zurücksenden</oc-link-v2>. Wo dein Paket gerade ist, siehst du unter <oc-link-v2 size="inherit">Meine Bestellungen</oc-link-v2>. Fragen beantwortet dir gern unser <oc-link-v2 size="inherit">Kundenservice</oc-link-v2>.</p>
<div
  style="max-width: 456px; border: 1px solid #ccc; padding: 16px; background-color: var(--oc-semantic-color-inverted-background) !important;"
>
  <p class="oc-copy-100" style="color: var(--oc-semantic-color-text-inverted) !important;">Du kannst deine Bestellung innerhalb von 30 Tagen kostenlos <oc-link-v2 variant="inverted" size="inherit">zurücksenden</oc-link-v2>. Wo dein Paket gerade ist, siehst du unter <oc-link-v2 variant="inverted" size="inherit">Meine Bestellungen</oc-link-v2>. Fragen beantwortet dir gern unser <oc-link-v2 variant="inverted" size="inherit">Kundenservice</oc-link-v2>.</p>
Older versions

Migration to v2

The oc-link component has been updated from oc-link-v1 to oc-link-v2. This migration guide provides a step-by-step guide to update your project to the latest version.

Skip to:

What's new
Web component

The link is now a proper web component instead of a CSS-only class, providing:

  • Encapsulated styling
  • Consistent behavior across the application
  • Better integration with other Otto Components

The <a> tag is placed inside the component slot, preserving native link behavior for search engine crawlers.

API changes
Changed structure
v1 (CSS class) v2 (Web Component) Notes
<a class="oc-link-v1"> <oc-link-v2><a>...</a></oc-link-v2> Link moved to slot
<button class="oc-link-v1"> <oc-link-v2 as-button> Component handles button styling
oc-link-v1--primary variant="primary" (default) Default variant
oc-link-v1--secondary variant="secondary" No change
oc-link-v1--underlined variant="underlined" No change
oc-link-v1--underlined-bold variant="underlined-bold" No change
oc-link-v1--size-50 size="50" No change
oc-link-v1--size-75 size="75" No change
oc-link-v1--size-100 size="100" No change
oc-link-v1--size-125 size="125" No change
How to migrate

Instead of using a div with the oc-link-v1 class, use the oc-link-v2 component tag to create a link. The oc-link-v2 component can be used as a link or button by adding the href or as-button attribute respectively.

Here's a table mapping deprecated CSS classes to their corresponding replacement attributes in the new version:

CSS-Class (V1) Attribute (V2) Notes
oc-link-v1--primary variant="primary" (default) Default variant
oc-link-v1--secondary variant="secondary" No change
oc-link-v1--underlined variant="underlined" No change
oc-link-v1--underlined-bold variant="underlined-bold" No change
oc-link-v1--size-50 size="50" No change
oc-link-v1--size-75 size="75" No change
oc-link-v1--size-100 size="100" No change
oc-link-v1--size-125 size="125" No change

To migrate a basic link, replace the anchor tag <a> including the oc-link-v1 class with the oc-link-v2 component tag and keep the href attribute.

<!-- From: -->
<a class="oc-link-v1" href="#">My Link</a>
<!-- To: -->
<oc-link-v2>
  <a href="#">My Link</a>
</oc-link-v2>

To migrate a link with a variant, replace the anchor tag <a> including the oc-link-v1 class with the oc-link-v2 component tag and add the variant attribute with the desired value.

<!-- From: -->
<a class="oc-link-v1 oc-link-v1--secondary" href="#">My Link</a>
<!-- To: -->
<oc-link-v2 variant="secondary">
  <a href="#">My Link</a>
</oc-link-v2>

To migrate a link with a size, replace the anchor tag <a> including the oc-link-v1 class with the oc-link-v2 component tag and add the size attribute with the desired value.

<!-- From: -->
<a class="oc-link-v1 oc-link-v1--size-50" href="#">My Link</a>
<!-- To: -->
<oc-link-v2 size="50">
  <a href="#">My Link</a>
</oc-link-v2>

To migrate a link as a button, replace the button tag including the oc-link-v1 class with the oc-link-v2 component tag and add the as-button attribute.

<!-- From: -->
<button class="oc-link-v1">My Link</button>
<!-- To: -->
<oc-link-v2 as-button="">My Link</oc-link-v2>