The interactive overlay provides a way to make content interactive. This component is useful in cases where you want to give your content states. It is used within several components, e.g. interactive logos, but may also be used standalone for custom interactive elements.
Configurator
<div style="--r:0px">
<oc-interactive-overlay-v2 style="--border-offset:2px;--border-radius:var(--r)">
<a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:96px;height:96px;border-radius:var(--r);background:var(--oc-semantic-color-background-soft-mint)"></span></a>
</oc-interactive-overlay-v2>
</div>Usage
Variants
The border offset is 2px by default, but it can be adjusted depending on size of the content.
HTML
<p class="demo-label">Hover, press and tab to the squares to see the overlay</p>
<oc-interactive-overlay-v2 style="--border-offset:2px;--border-radius:0px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:0px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">Small content: offset 2px</p></div>
<oc-interactive-overlay-v2 style="--border-offset:8px;--border-radius:0px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:80px;height:80px;border-radius:0px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">Large content: offset 8px</p></div>
Adapt the border radius when there is a border radius used inside the content. Use border-radius design tokens for this, as they use relative values.
The border radius of the interactive overlay automatically adapts using the following formula meeting the general border radius requirements:
border radius of the content + offset
= outer radius of the interactive overlay
Hover, press and tab to the squares to see the overlay
HTML
<p class="demo-label">Hover, press and tab to the squares to see the overlay</p>
<oc-interactive-overlay-v2 style="--border-offset:2px;--border-radius:0px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:0px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">context border radius: 0px<br>offset: 2px<br>outer radius: 2px</p></div>
<oc-interactive-overlay-v2 style="--border-offset:2px;--border-radius:8px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:8px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">context border radius: 8px<br>offset: 2px<br>outer radius: 10px</p></div>
<oc-interactive-overlay-v2 style="--border-offset:2px;--border-radius:16px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:16px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">context border radius: 16px<br>offset: 2px<br>outer radius: 18px</p></div>
<oc-interactive-overlay-v2 style="--border-offset:4px;--border-radius:0px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:0px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">context border radius: 0px<br>offset: 4px<br>outer radius: 4px</p></div>
<oc-interactive-overlay-v2 style="--border-offset:0px;--border-radius:8px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:8px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">context border radius: 8px<br>offset: 0px<br>outer radius: 8px</p></div>
<oc-interactive-overlay-v2 style="--border-offset:4px;--border-radius:16px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;border-radius:16px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2><p class="demo-label" style="text-align:center">context border radius: 16px<br>offset: 4px<br>outer radius: 20px</p></div>
Behavior
States
HTML
<p class="demo-label">Enabled: hover it, press it and tab to it for the focus ring</p>
<oc-interactive-overlay-v2 style="--border-offset:8px;--border-radius:0px"><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:128px;height:128px;border-radius:0px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2></div>
Fitting
The interactive overlay uses fit-content for the width and height. The border offset is set inside the component and added automatically. It does not effect the actual height or width of the interactive overlay.
HTML
<span style="outline:1px dashed #e5006b"><oc-interactive-overlay-v2><a href="#" aria-label="Zum Angebot" style="display:block"><span style="display:block;width:48px;height:48px;background:var(--oc-semantic-color-background-soft-mint)"></span></a></oc-interactive-overlay-v2></span>
Best practices
Accessibility
Implementation
Live demo
Hover, press and tab through the logo and the header icons
HTML
<div class="on-frame" style="margin:0;padding:24px">
<div style="display:grid;gap:16px;max-width:880px;margin:0 auto">
<div style="background:#fff;border-radius:16px;padding:12px 16px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:16px;align-items:center">
<oc-interactive-overlay-v2 style="--border-radius:4px;--border-offset:4px"><a href="#" aria-label="OTTO Startseite" style="display:block;width:88px"><img src="/references/logos/otto/otto-de-press-Otto_Logo_rgb.png" alt="" style="display:block;margin:0;width:100%"></a></oc-interactive-overlay-v2>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<oc-interactive-overlay-v2 style="--border-radius:8px;--border-offset:4px"><a href="#" class="oc-text-color-secondary oc-copy-50" aria-label="Mein Konto" style="display:grid;justify-items:center;padding:0 4px;text-decoration:none"><oc-icon-v1 size="100" type="person" style="grid-area:1/1"></oc-icon-v1><oc-badge-v2 variant="success" icon="check" style="grid-area:1/1;margin:8px 0 0 16px"></oc-badge-v2><span>Mein Konto</span></a></oc-interactive-overlay-v2>
<oc-interactive-overlay-v2 style="--border-radius:8px;--border-offset:4px"><a href="#" class="oc-text-color-secondary oc-copy-50" aria-label="Merkzettel" style="display:grid;justify-items:center;padding:0 4px;text-decoration:none"><oc-icon-v1 size="100" type="wishlist" style="grid-area:1/1"></oc-icon-v1><oc-badge-v2 variant="secondary" style="grid-area:1/1;margin:8px 0 0 16px">3</oc-badge-v2><span>Merkzettel</span></a></oc-interactive-overlay-v2>
<oc-interactive-overlay-v2 style="--border-radius:8px;--border-offset:4px"><a href="#" class="oc-text-color-secondary oc-copy-50" aria-label="Warenkorb" style="display:grid;justify-items:center;padding:0 4px;text-decoration:none"><oc-icon-v1 size="100" type="basket" style="grid-area:1/1"></oc-icon-v1><oc-badge-v2 variant="primary" style="grid-area:1/1;margin:8px 0 0 16px">1</oc-badge-v2><span>Warenkorb</span></a></oc-interactive-overlay-v2>
<div style="position:relative;border-radius:16px;overflow:hidden"><img src="/previews/imagery/samples/otto-colour-field/colour-field-sneaker.webp" alt="Weißer Sneaker auf rotem Grund" style="display:block;margin:0;width:100%;aspect-ratio:3/1;object-fit:cover"><div style="position:absolute;left:32px;top:50%;transform:translateY(-50%);display:grid;gap:12px;color:#fff"><p class="oc-headline-300">Sneaker-Woche</p><p class="oc-copy-100">Bis zu 30 % auf ausgewählte Modelle</p><div><oc-button-v1 variant="secondary-over-color" fit-content>Zu den Sneakern</oc-button-v1></div></div></div>

