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
LiveInteractive overlay: hover, press and tab to the square to see the states. The overlay radius follows the content radius plus the offset.
Enabled: hover it, press it and tab to it for the focus ring
LiveStatesHTML
<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.
fit-content in width and height; the border offset is added outside and does not change the size
Only the latest version (v2) is allowed for generation. Older versions are kept for reference and are deprecated.
Overview (v2)
Interactive overlay
The interactive overlay component provides a way to make your content interactive.
This component is useful in cases where you want to give your content a hover effect, an active state, or a link ability.
Default variation
Per default, I am not interactive.
HTML
<oc-interactive-overlay-v2>Per default, I am not interactive.</oc-interactive-overlay-v2>
Configuration
The interactive overlay component is configurable, allowing you to tailor its features and appearance to your specific needs.
To explore all the available options and adjust the component, use the component configurator and see the changes affect the component in real-time.
Usage guidelines
Before integrating the interactive overlay component into your project, make sure you have correctly installed the OTTO components package.
Look through the variations page for examples of possible component variations.
This component has potential visual overflow.
When the border-offset property is used, the component extends beyond its bounding box and is clipped by parent containers with overflow: hidden.
Ensure the parent container has sufficient padding to accommodate the component's full visual area.
Accessibility
The interactive overlay component relies on the slotted interactive element, so pass aria attributes directly if needed.
Reference the built-in accessibility features guide for focus management and keyboard interactions.
Configuration (v2)
Interactive overlay V2 configuration
Configure the interactive overlay component with the controls below and see the changes live in the preview canvas.
Click the Show code button within the preview canvas to see the source code for the current component configuration.
Per default, I am not interactive.
HTML
<oc-interactive-overlay-v2>Per default, I am not interactive.</oc-interactive-overlay-v2>
Interactive configurator (Storybook controls); every option is listed in the API section of this file.
Migration (v2)
Migration from Interactive Overlay v1 to v2
The oc-interactive-overlay component has been updated from oc-interactive-overlay-v1 to oc-interactive-overlay-v2.
This migration guide provides step-by-step instructions to update your project to the latest version.
In v2, the component no longer manages the interactive behavior (button/link) itself. Instead, you place a native interactive element (<button>, <a>, <a data-masked-ref> for masked links) directly in the default slot. This provides:
Better accessibility with native semantics
Full control over the interactive element's attributes (aria-label, rel, target, etc.)
Native event support on the interactive element itself
API changes
Removed attributes
The following attributes have been removed and their functionality is now handled differently:
v1 Attribute
v2 Equivalent
Notes
base64-href
data-masked-ref on the slotted element
Moved from component attribute to slotted element
border-offset
--border-offset CSS custom property
Moved from HTML attribute to CSS custom property
border-radius
--border-radius CSS custom property
Moved from HTML attribute to CSS custom property
oc-aria-label
aria-label on the slotted element
Use aria-label directly on the child element
rel
rel on the slotted <a> element
Moved from component attribute to slotted <a> element
target
target on the slotted <a> element
Moved from component attribute to slotted <a> element
Unchanged CSS custom properties
CSS Custom Property
Notes
--border-radius
No change
--border-offset
No change
How to migrate
Migrate a basic interactive overlay
For a basic interactive overlay that acts as a button, the main change is the tag name and moving the interactive element into the default slot as a native element.
<!-- To: -->
<oc-interactive-overlay-v2>
<a href="#">Content</a>
</oc-interactive-overlay-v2>
Note: Only the tag name changes here — the slotted <a> element stays exactly the same.
Migrate an interactive overlay with masked link behavior
In v1, a masked link was created using the base64-href attribute. In v2, the masking is done via a data-masked-ref attribute on the interactive element inside the default slot.
<!-- To: -->
<oc-interactive-overlay-v2>
<div data-masked-ref="Iw==" role="link" tabindex="0">Content</div>
</oc-interactive-overlay-v2>
Migrate an interactive overlay with link switch behavior
In v1, link switching was achieved using base64-href together with an <a> tag in the slot. In v2, the data-masked-ref attribute is placed directly on the <a> element.
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.
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.
CSS custom properties
Custom property
Default
Description
--border-radius
undefined
Sets a custom border radius for the interactive overlay component.
--border-offset
undefined
Sets a custom border offset for the interactive overlay component.
Variations (v2)
Variations
Listed below are the most common variations of the interactive overlay component as well as specific component variations for different use cases.
You can explore all available options using the component configurator, adjust the component to your needs, and see the changes live in a preview canvas.
The interactive overlay component as a masked link. Search engines will not detect the href.
Args: defaultSlot=(see snippet)
I act as a masked link. Search engines will not see me as a link.
HTML
<oc-interactive-overlay-v2>
<div data-masked-ref='Iw==' role='link' tabindex='0'>I act as a masked link. Search engines will not see me as a link.</div>
</oc-interactive-overlay-v2>
<oc-interactive-overlay-v2>
<a href='#' data-masked-ref='Iw=='>I act as a link. Search engines will get another link than users.</a>
</oc-interactive-overlay-v2>
The interactive overlay component provides a way to make your content interactive.
This component is useful in cases where you want to give your content a hover effect, an active state, or a link ability.
Default variation
<oc-interactive-overlay-v1>I act as a button. Add a click event to see me in action.</oc-interactive-overlay-v1>
Configuration
The interactive overlay component is configurable, allowing you to tailor its features and appearance to your specific needs.
To explore all the available options and adjust the component, use the component configurator and see the changes affect the component in real-time.
Usage guidelines
Before integrating the interactive overlay component into your project, make sure you have correctly installed the OTTO components package.
Look through the variations page for examples of possible component variations.
Layout considerations
This component has potential visual overflow.
When the border-offset property is used, the component extends beyond its bounding box and is clipped by parent containers with overflow: hidden.
Ensure the parent container has sufficient padding to accommodate the component's full visual area.
Accessibility
The interactive overlay component comes with a set of built-in accessibility features to ensure a seamless experience for all users.
Use oc-aria-label
To make the interactive overlay recognizable for screen readers, use the oc-aria-label attribute to provide clear and descriptive context information.
See the general accessibility documentation for guidance on using oc-aria-label, including how it works with link and masked link behavior.
Button or masked link
See Link behavior and masked links in the general accessibility documentation for how oc-aria-label is applied in these scenarios.
V1/Configuration (v1, deprecated, not for generation)
Interactive overlay configuration
Configure the interactive overlay component with the controls below and see the changes live in the preview canvas.
Click the Show code button within the preview canvas to see the source code for the current component configuration.
<oc-interactive-overlay-v1>I act as a button. Add a click event to see me in action.</oc-interactive-overlay-v1>
Interactive configurator (Storybook controls); every option is listed in the API section of this file.
V1/Variations (v1, deprecated, not for generation)
Variations
Listed below are the most common variations of the interactive overlay component as well as specific component variations for different use cases.
You can explore all available options using the component configurator, adjust the component to your needs, and see the changes live in a preview canvas.
The interactive overlay component as a link. Search engines will detect the href.
Args: defaultSlot=(see snippet)
<oc-interactive-overlay-v1>
<!--The <a> tag should be placed inside the light DOM to improve SEO.--><a href='#'>I act as a link. Search engines will see me as a link.</a>
</oc-interactive-overlay-v1>
<oc-interactive-overlay-v1 base64-href="Iz92YXJpYW50PWZvbw==">
<!--Search engines will detect the href, while users receive the Base64-encoded version.--><a href='#'>I act as a link. Search engines will get another link than users.</a>
</oc-interactive-overlay-v1>