OTTODesign System

Components

Icon button

Icon buttons display actions in a compact layout. Icon buttons should only be used when the meaning of their icon is clear.

Configurator

LiveIcon button: switch the ground to Frame for the default variant on colour.
HTML
<oc-icon-button-v3 variant="secondary-over-color" icon="wishlist" label="Merken" oc-aria-label="Merken"></oc-icon-button-v3>

Usage

Variants

Icon buttons are available in the sizes 25, 50, 75 and 100. They come in three different variants which differ in background and icon color:

  • secondary-over-color
  • primary
  • secondary
  • tertiary
  • success
  • transparent
  • transparent-inverted
  • custom-color-soft
  • custom-color-strong

secondary-over-color, on frame

primary

secondary

tertiary

success

transparent, on frame

transparent-inverted, on dark

custom-color-strong

custom-color-soft

LiveVariants
HTML
<p class="demo-label">secondary-over-color, on frame</p><oc-icon-button-v3 variant="secondary-over-color" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label">primary</p><oc-icon-button-v3 variant="primary" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label">secondary</p><oc-icon-button-v3 variant="secondary" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label">tertiary</p><oc-icon-button-v3 variant="tertiary" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label">success</p><oc-icon-button-v3 variant="secondary" success size="100" icon="check" oc-aria-label="Gemerkt"></oc-icon-button-v3></div>
<p class="demo-label">transparent, on frame</p><oc-icon-button-v3 variant="transparent" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label" style="color:#fff">transparent-inverted, on dark</p><oc-icon-button-v3 variant="transparent-inverted" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label">custom-color-strong</p><oc-icon-button-v3 variant="custom-color-strong" size="100" icon="wishlist" oc-aria-label="Merken" style="--background-color: var(--oc-semantic-color-background-strong-mint); --icon-color: var(--oc-semantic-color-background-soft-mint)"></oc-icon-button-v3></div>
<p class="demo-label">custom-color-soft</p><oc-icon-button-v3 variant="custom-color-soft" size="100" icon="wishlist" oc-aria-label="Merken" style="--background-color: var(--oc-semantic-color-background-soft-mint); --icon-color: var(--oc-semantic-color-text-default)"></oc-icon-button-v3></div>
LiveSize
HTML
<oc-icon-button-v3 size="25" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<oc-icon-button-v3 size="50" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<oc-icon-button-v3 size="75" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<oc-icon-button-v3 size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>

Icon buttons can be put into a loading state. This replaces the icon on the right with a spinner. This feature should be used for actions expected to complete asynchronously. During loading, the button has no interactive states and is not interactive.

LiveLoading state in different variants
HTML
<oc-icon-button-v3 variant="secondary-over-color" size="100" loading icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<oc-icon-button-v3 variant="transparent" size="100" loading icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<span style="display:inline-flex;padding:16px 40px;background:#212121"><oc-icon-button-v3 variant="transparent-inverted" size="100" loading icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></span>
<oc-icon-button-v3 variant="custom-color-strong" size="100" loading icon="wishlist" oc-aria-label="Merken" style="--background-color: var(--oc-semantic-color-background-strong-mint); --icon-color: var(--oc-semantic-color-background-soft-mint)"></oc-icon-button-v3>
<oc-icon-button-v3 variant="custom-color-soft" size="100" loading icon="wishlist" oc-aria-label="Merken" style="--background-color: var(--oc-semantic-color-background-soft-mint); --icon-color: var(--oc-semantic-color-text-default)"></oc-icon-button-v3>

You can replace the icon itself with other icons from our icon library. You can also change the icon color and the background color using the colors from our design system. But be sure to maintain a color contrast of at least 3:1.

LiveDifferent icons and icon color
HTML
<oc-icon-button-v3 size="100" icon="smiley-positive" oc-aria-label="Bewerten"></oc-icon-button-v3>
<oc-icon-button-v3 variant="custom-color-soft" size="100" icon="smiley-positive" oc-aria-label="Bewerten" style="--background-color: #fff; --icon-color: var(--oc-semantic-color-text-brand)"></oc-icon-button-v3>
<oc-icon-button-v3 variant="custom-color-strong" size="100" icon="smiley-positive" oc-aria-label="Bewerten" style="--background-color: var(--oc-semantic-color-background-strong-purple); --icon-color: #fff"></oc-icon-button-v3>
<oc-icon-button-v3 size="100" icon="sneaker" oc-aria-label="Sneaker"></oc-icon-button-v3>
<oc-icon-button-v3 variant="custom-color-soft" size="100" icon="sneaker" oc-aria-label="Sneaker" style="--background-color: #fff; --icon-color: var(--oc-semantic-color-text-brand)"></oc-icon-button-v3>
<oc-icon-button-v3 variant="custom-color-strong" size="100" icon="sneaker" oc-aria-label="Sneaker" style="--background-color: var(--oc-semantic-color-background-strong-purple); --icon-color: #fff"></oc-icon-button-v3>

Behavior

States

secondary-over-color on frame: enabled (hover, press and tab to it), disabled

transparent on frame: enabled, disabled

transparent-inverted on dark: enabled, disabled

LiveStates
HTML
<p class="demo-label">secondary-over-color on frame: enabled (hover, press and tab to it), disabled</p>
<oc-icon-button-v3 variant="secondary-over-color" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3><oc-icon-button-v3 variant="secondary-over-color" size="100" disabled icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label">transparent on frame: enabled, disabled</p>
<oc-icon-button-v3 variant="transparent" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3><oc-icon-button-v3 variant="transparent" size="100" disabled icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<p class="demo-label" style="color:#fff">transparent-inverted on dark: enabled, disabled</p>
<oc-icon-button-v3 variant="transparent-inverted" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3><oc-icon-button-v3 variant="transparent-inverted" size="100" disabled icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>

Interaction

The icon button 50 has an extended hitbox to fulfill the optimal size for touch targets. The icon button 25 meets minimum accessibility requirements of 24px as in WCAG 2.1 AA but is not recommended for touch input - so do not use it for important interactions.

1rem + 8px

2rem + 16px

3rem

LiveHitbox sizes
HTML
<span style="display:inline-flex;padding:4px;border:1px dashed #e5006b;background:rgba(229,0,107,.15)"><oc-icon-button-v3 size="25" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></span><p class="demo-label">1rem + 8px</p></div>
<span style="display:inline-flex;padding:8px;border:1px dashed #e5006b;background:rgba(229,0,107,.15)"><oc-icon-button-v3 size="50" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></span><p class="demo-label">2rem + 16px</p></div>
<span style="display:inline-flex;border:1px dashed #e5006b;background:rgba(229,0,107,.15)"><oc-icon-button-v3 size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></span><p class="demo-label">3rem</p></div>

Optionally you can set a label for an icon button to describe it. The label is shown in a tooltip while you hover or long press the icon button.

Hover over the icon button: the label appears as a tooltip

LiveLabel shown in a tooltip
HTML
<oc-icon-button-v3 icon="mic" label="Spracheingabe" oc-aria-label="Spracheingabe"></oc-icon-button-v3>

Placement

You can use canvas, above or sticky as elevation levels for the icon button. The elevation level stacked is not supported. For canvas there is no shadow, the icon button appears flat and should be used on frame or canvas. For above there is a shadow and the icon button appears above other levels. For sticky there is also a shadow, the icon button appears above all other levels and is sticky.

canvas, on frame

canvas, on white

above

sticky

LiveElevation levels
HTML
<p class="demo-label">canvas, on frame</p>
<oc-icon-button-v3 elevation-level="canvas" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<p class="demo-label">canvas, on white</p>
<oc-icon-button-v3 elevation-level="canvas" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<p class="demo-label">above</p>
<oc-icon-button-v3 elevation-level="above" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>
<p class="demo-label">sticky</p>
<oc-icon-button-v3 elevation-level="sticky" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3>

Best practices

DoOnly use the same icon button sizes in the same feature.
Don'tMix icon button sizes inside the same feature.

at least 8px between the buttons

DoLeave at least 8px between icon buttons to avoid overlapping hitboxes.
CautionRemember that the hitbox of the Icon Button 25 and 50 is larger than the Icon Button itself.
DoUse icons that clearly represent the action.
Don'tUse icons which do not represent the action.

Accessibility

For better accessibility it is mandatory to use an aria-label.

Implementation

Live demo

Empfehlungen für dich

Schwarzer Over-Ear-Kopfhörer

Over-Ear-Kopfhörer mit Noise Cancelling

149,99 €

Sessel mit Bouclé-Bezug und Eichenholzgestell

Sessel „Lina“, Bouclé, Eiche

399,00 €

Weißer Ledersneaker

Ledersneaker „Court“, weiß

89,99 €

LiveReal OTTO components, rendered by the OTTO component runtime
HTML
<div class="on-frame" style="margin:0;padding:24px">
<div style="display:grid;gap:16px;max-width:880px;margin:0 auto">
<p class="oc-headline-100">Empfehlungen für dich</p><div class="demo-row gap-8"><oc-icon-button-v3 icon="arrow-left" oc-aria-label="Zurück blättern" disabled></oc-icon-button-v3><oc-icon-button-v3 icon="arrow-right" oc-aria-label="Weiter blättern"></oc-icon-button-v3></div></div>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:16px">
  <div style="background:#fff;border-radius:16px;overflow:hidden"><div style="position:relative"><img src="/previews/imagery/samples/otto-product-still/product-headphones.webp" alt="Schwarzer Over-Ear-Kopfhörer" style="display:block;margin:0;width:100%;aspect-ratio:1;object-fit:cover"><div style="position:absolute;top:12px;right:12px"><oc-icon-button-v3 elevation-level="above" icon="wishlist" label="Merken" oc-aria-label="Kopfhörer merken"></oc-icon-button-v3></div></div><div style="display:grid;gap:4px;padding:12px 16px 16px"><p class="oc-copy-75">Over-Ear-Kopfhörer mit Noise Cancelling</p><p class="oc-headline-50">149,99 €</p></div></div>
  <div style="background:#fff;border-radius:16px;overflow:hidden"><div style="position:relative"><img src="/previews/imagery/samples/otto-product-still/product-armchair.webp" alt="Sessel mit Bouclé-Bezug und Eichenholzgestell" style="display:block;margin:0;width:100%;aspect-ratio:1;object-fit:cover"><div style="position:absolute;top:12px;right:12px"><oc-icon-button-v3 elevation-level="above" success icon="wishlist-active" label="Gemerkt" oc-aria-label="Sessel gemerkt"></oc-icon-button-v3></div></div><div style="display:grid;gap:4px;padding:12px 16px 16px"><p class="oc-copy-75">Sessel „Lina“, Bouclé, Eiche</p><p class="oc-headline-50">399,00 €</p></div></div>
  <div style="background:#fff;border-radius:16px;overflow:hidden"><div style="position:relative"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="Weißer Ledersneaker" style="display:block;margin:0;width:100%;aspect-ratio:1;object-fit:cover"><div style="position:absolute;top:12px;right:12px"><oc-icon-button-v3 elevation-level="above" icon="wishlist" label="Merken" oc-aria-label="Sneaker merken"></oc-icon-button-v3></div></div><div style="display:grid;gap:4px;padding:12px 16px 16px"><p class="oc-copy-75">Ledersneaker „Court“, weiß</p><p class="oc-headline-50 oc-text-color-sale">89,99 €</p></div></div>

Code

Version Tag Status API
v3 <oc-icon-button-v3> Stable IconButtonV3
v2 <oc-icon-button-v2> Deprecated IconButtonV2
v1 <oc-icon-button-v1> Deprecated IconButtonV1

API

API: <oc-icon-button-v3> (IconButtonV3)

The Icon Button component provides an interactive icon on a circular white background, with attributes for setting the icon type, size, ARIA label, a disabled state and emitting a click event when interacted with.

Attributes / properties
Attribute Type Default Required Description
variant
9 values"primary" | "secondary" | "secondary-on-color" | "secondary-over-color" | "tertiary" | "custom-color-strong" | "custom-color-soft" | "transparent" | "transparent-inverted"
"secondary-over-color" no Selects the style of icon button to be used. secondary-on-color is deprecated, use secondary-over-color instead.
size "50" | "100" | "25" | "75" "50" no Sets the size of the icon button. Can be one of: 25, 50, 75, 100.
icon icon name yes Sets the displayed icon. Find all available icons here.
label string undefined no When set a Tooltip with the label content will be displayed on hover.
disabled boolean false no Toggles the state of the icon button between enabled and disabled. Set to true to disable the button and prevent user interaction.
loading boolean false no Toggles the state of the button between loading and not loading. Set to true to enable the loading state and display a loading animation.
success boolean false no Sets the success state of the icon-button. This is a visual state that indicates a successful action. It does not change the functionality of the icon-button.
elevation-level "canvas" | "above" | "sticky" "canvas" no Sets the elevation level of the icon button. The elevation level determines the shadow and depth of the icon button. - canvas: no shadow, icon button appears flat, to be used on frame. - above: shadow, icon button appears above other levels. - sticky: shadow, icon button appears above all other levels and is sticky.
background-color string undefined no Deprecated: The background-color attribute is deprecated. Use the CSS variable --background-color instead.

Sets the background color of the icon button.
icon-color string undefined no Deprecated: The icon-color attribute is deprecated. Use the CSS variable --icon-color instead.

Sets the color of the displayed icon. This overrides the default color in all cases except for the disabled state.
base64-href string undefined no Sets the base64 encoded link target of the icon button. 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 icon button.

Note Only applies when base64Href is set.
rel string undefined no Sets the rel attribute of the icon button.

Note Only applies when base64Href is set.
oc-aria-label string yes Sets the ARIA label of the icon button.
Slots
Slot Required Description
default no Add an empty tag to change the default behavior of the icon button component.

- empty a tag: the icon button component behaves as a link (SEO relevant)
Events
Event Detail type Description
click PointerEvent Clicking the icon button or pressing the Enter or Space key while the icon button is focused triggers the click event.
oc-property-change OcIconButtonV3Events["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.
CSS custom properties
Custom property Default Description
--background-color undefined Sets a custom background color through a CSS variable.

Note: The preferred way of using colors is via design tokens instead of hex values.

Note: This CSS variable only applies when using variant="custom-color-strong" or variant="custom-color-soft".
--icon-color undefined Sets a custom text color through a CSS variable.

Note: The preferred way of using colors is via design tokens instead of hex values.

Note: This CSS variable only applies when using variant="custom-color-strong" or variant="custom-color-soft".

Examples

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

Default

The default configuration uses the icon=wishlist and size=50.

HTML
<oc-icon-button-v3 icon="wishlist" oc-aria-label="Default icon button component"></oc-icon-button-v3>
Transparent 75

The transparent variant uses no background color for the icon button.

HTML
<oc-icon-button-v3 icon="wishlist" size="75" variant="transparent" oc-aria-label="Icon button of size 75 and variant transparent"></oc-icon-button-v3>
Transparent-Inverted 75

The transparent-inverted variant features a white icon on a transparent background, suitable for dark backgrounds.

HTML
<oc-icon-button-v3 icon="wishlist" size="75" variant="transparent-inverted" oc-aria-label="Icon button of size 75 and variant inverted"></oc-icon-button-v3>
Transparent 50

The transparent variant uses no background color for the icon button.

HTML
<oc-icon-button-v3 icon="wishlist" size="50" variant="transparent" oc-aria-label="Icon button of size 50 and variant transparent"></oc-icon-button-v3>
Transparent-Inverted 50

The transparent-inverted variant features a white icon on a transparent background, suitable for dark backgrounds.

HTML
<oc-icon-button-v3 icon="wishlist" size="50" variant="transparent-inverted" oc-aria-label="Icon button of size 50 and variant inverted"></oc-icon-button-v3>
Success 100

The success variant uses a green icon on a green background.

HTML
<oc-icon-button-v3 icon="check" size="100" success oc-aria-label="Icon button of size 100 and success state"></oc-icon-button-v3>
Older versions

Migration to v3

Migration from Icon Button v2 to v3

The oc-icon-button component has been updated from oc-icon-button-v2 to oc-icon-button-v3. This migration guide provides step-by-step instructions to update your project to the latest version.

Skip to:

What's new
Built-in tooltip

The oc-icon-button-v3 includes a built-in tooltip via the label attribute:

HTML
<oc-icon-button-v3 icon="wishlist" label="Add to wishlist"></oc-icon-button-v3>
New variants

Additional styling variants are available for different use cases.

API changes
Removed attributes
v2 Attribute v3 Equivalent Notes
elevation="100" elevation-level="canvas" Renamed to semantic values
elevation="200" elevation-level="above" Renamed to semantic values
elevation="300" elevation-level="sticky" Renamed to semantic values
href Use an <a> tag inside the default slot Moved to slot for better SEO
How to migrate

The oc-icon-button-v3 removes the deprecated properties elevation and href. Additionally, it brings several new variants and a built-in tooltip.

Migrate a basic icon button
<!-- From: -->
<oc-icon-button-v2 icon="wishlist" elevation="200"></oc-icon-button-v2>
<!-- To: -->
<oc-icon-button-v3 icon="wishlist" elevation-level="above"></oc-icon-button-v3>
Migrate an icon button with href
<!-- From: -->
<oc-icon-button-v2 icon="wishlist" href="/wishlist"></oc-icon-button-v2>
<!-- To: -->
<oc-icon-button-v3 icon="wishlist">
  <a href="/wishlist"></a>
</oc-icon-button-v3>

API v1

API: <oc-icon-button-v1> (IconButtonV1)

The Icon Button component provides an interactive icon on a circular white background, with attributes for setting the icon type, size, ARIA label, a disabled state and emitting a click event when interacted with.

Attributes / properties
Attribute Type Default Required Description
variant "default" | "transparent" | "inverted" "default" no Selects the style of icon button to be used.

Can be one of: default, transparent, and inverted.
size "50" | "100" | "25" "50" no Sets the size of the icon button. Can be one of: 25, 50, 100.
icon-type icon name yes Sets the displayed icon. Find all available icons here.
transparent boolean false no Deprecated: Please use the variant property instead.

DEPRECATED: When enabled, sets the variant to transparent.
disabled boolean false no Toggles the state of the icon button between enabled and disabled. Set to true to disable the button and prevent user interaction.
loading boolean false no Toggles the state of the button between loading and not loading. Set to true to enable the loading state and display a loading animation.
elevated boolean undefined no Deprecated: Please use the elevation property instead.

DEPRECATED: When enabled, sets the elevation of the icon button to 200.
elevation "100" | "200" | "300" | "0" "0" no Sets the elevation level of the icon button. Can be one of: 0, 100, 200 or 300.
icon-color string undefined no Sets the color of the displayed icon. This overrides the default color in all cases except for the disabled state.
href string undefined no Sets the link target of the icon button.
base64-href string undefined no Sets the base64 encoded link target of the energy label. Use this attribute to prevent search engines from indexing the link target.
oc-aria-label string yes Sets the ARIA label of the icon button.
Events
Event Detail type Description
click PointerEvent Clicking the icon button or pressing the Enter or Space key while the icon button is focused triggers the click event.
oc-property-change OcIconButtonV1Events["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.

API v2

API: <oc-icon-button-v2> (IconButtonV2)

The Icon Button component provides an interactive icon on a circular white background, with attributes for setting the icon type, size, ARIA label, a disabled state and emitting a click event when interacted with.

Attributes / properties
Attribute Type Default Required Description
variant "default" | "transparent" | "inverted-transparent" "default" no Selects the style of icon button to be used.

Can be one of: default, transparent, and inverted-transparent.
size "50" | "100" | "25" "50" no Sets the size of the icon button. Can be one of: 25, 50, 100.
icon icon name yes Sets the displayed icon. Find all available icons here.
disabled boolean false no Toggles the state of the icon button between enabled and disabled. Set to true to disable the button and prevent user interaction.
loading boolean false no Toggles the state of the button between loading and not loading. Set to true to enable the loading state and display a loading animation.
elevation "100" | "200" | "300" | "0" "0" no Sets the elevation level of the icon button. Can be one of: 0, 100, 200 or 300.
icon-color string undefined no Sets the color of the displayed icon. This overrides the default color in all cases except for the disabled state.
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 icon button.
base64-href string undefined no Sets the base64 encoded link target of the energy label. 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 icon button.

Note Only applies when base64Href is set.
rel string undefined no Sets the rel attribute of the icon button.

Note Only applies when base64Href is set.
oc-aria-label string yes Sets the ARIA label of the icon button.
Slots
Slot Required Description
default no Add an empty tag to change the default behavior of the icon button component.

- empty a tag: the card component behaves as a link (SEO relevant)
Events
Event Detail type Description
click PointerEvent Clicking the icon button or pressing the Enter or Space key while the icon button is focused triggers the click event.
oc-property-change OcIconButtonV2Events["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.