OTTODesign System

Components

Selection tile

A selection tile is used to select options. They are typically used when users need to choose from multiple article options or variants in single- or multi-selection modes.

Configurator

LiveSelection tile: variant, strike-through, width, selection type and state
HTML
<oc-selection-tile-v2 color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" name="cfg-tile" aria-label="XL"><label slot="content">XL</label></oc-selection-tile-v2>

Usage

Variants

Selection tiles are available in the following variants:

  • text
  • color
  • image
  • container
LiveText, color, image and container variant
HTML
<oc-selection-tile-v2 variant="text"><label slot="content">XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" aria-label="Mint"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="image" img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="checkbox" aria-label="Weiß"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container"><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:64px;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" aria-label="Sneaker Weiß"></oc-selection-tile-v2>

You can use the selection tile with a single or a multi selection mode. For the single selection you can select one tile at once. For the multi selection you can select multiple tiles simultaneously.

Single selection (radio)

Multi selection (checkbox)

LiveSingle and multi selection
HTML
<p class="demo-label">Single selection (radio)</p>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XS</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">S</label><input type="radio" name="st-single" checked aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">M</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">L</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XL</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XXL</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">3XL</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">4XL</label><input type="radio" name="st-single" aria-label="oc-auto"></oc-selection-tile-v2>
<p class="demo-label">Multi selection (checkbox)</p>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XS</label><input type="checkbox" checked aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">S</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">M</label><input type="checkbox" checked aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">L</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XXL</label><input type="checkbox" checked aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">3XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">4XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>

If the option is not available, you can use the strike-through variant. The strike-through variant is available for each variant mentioned above. In comparison to the disabled property, this variant is still interactive.

LiveStrike-throught variants
HTML
<oc-selection-tile-v2 variant="text" strike-through><label slot="content">XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" strike-through color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" aria-label="Mint, nicht verfügbar"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="image" strike-through img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="checkbox" aria-label="Weiß, nicht verfügbar"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container" strike-through><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:64px;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" aria-label="Sneaker Weiß, nicht verfügbar"></oc-selection-tile-v2>

Selection signifiers

You can optionally add a selection signifier to increase the affordance of the selection tile. The variant (radio/checkbox) is automatically derived from the selection tile's properties.

Checkbox signifier (multi selection)

Geschenkverpackung
Wir packen deinen Artikel für 2,95 € als Geschenk ein.

Radio signifier (single selection)

Expresslieferung
Bestellst du bis 12 Uhr, kommt dein Paket morgen.
LiveSelection Signifier
HTML
<p class="demo-label">Checkbox signifier (multi selection)</p>
<oc-selection-tile-v2 variant="text" width-behavior="fill"><input type="checkbox" aria-label="Geschenkverpackung"><div slot="content" style="text-align:left"><div class="demo-row"><oc-selection-signifier-v1></oc-selection-signifier-v1><span class="oc-copy-100 oc-copy--bold">Geschenkverpackung</span></div><div>Wir packen deinen Artikel für 2,95 € als Geschenk ein.</div></div></oc-selection-tile-v2>
<p class="demo-label">Radio signifier (single selection)</p>
<oc-selection-tile-v2 variant="text" width-behavior="fill"><input type="radio" name="st-sig" aria-label="Expresslieferung"><div slot="content" style="text-align:left"><div class="demo-row"><oc-selection-signifier-v1></oc-selection-signifier-v1><span class="oc-copy-100 oc-copy--bold">Expresslieferung</span></div><div>Bestellst du bis 12 Uhr, kommt dein Paket morgen.</div></div></oc-selection-tile-v2>

Behavior

States

Enabled (hover, press, focus it)

Selected

Disabled

LiveStates
HTML
<p class="demo-label">Enabled (hover, press, focus it)</p>
<oc-selection-tile-v2><label slot="content">M</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" aria-label="Mint"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="image" img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="checkbox" aria-label="Weiß"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container"><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:64px;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" aria-label="Sneaker Weiß"></oc-selection-tile-v2>
<p class="demo-label">Selected</p>
<oc-selection-tile-v2><label slot="content">M</label><input type="checkbox" checked aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" checked aria-label="Mint"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="image" img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="checkbox" checked aria-label="Weiß"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container"><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:64px;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" checked aria-label="Sneaker Weiß"></oc-selection-tile-v2>
<p class="demo-label">Disabled</p>
<oc-selection-tile-v2><label slot="content">M</label><input type="checkbox" disabled aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" disabled aria-label="Mint"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="image" img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="checkbox" disabled aria-label="Weiß"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container"><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:64px;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" disabled aria-label="Sneaker Weiß"></oc-selection-tile-v2>

Fitting

The text variant has a fixed height. It can use either fit-content or fill-parent. When using fill-parent, ensure that the content is completely visible.

The image and color variant size is 1.5rem, but the hitbox size is 2rem. The hitbox size is calculated based on the recommended 8px gap between them.

The behavior of the container variant can be freely chosen and you can for example use fit-content, fill-parent or a custom fixed size. You can use any kind of content for the container variant.

fit-content (height fixed)

fill-parent

LiveFitting text and content variant
HTML
<p class="demo-label">fit-content (height fixed)</p>
<oc-selection-tile-v2><label slot="content">XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container"><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:64px;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" aria-label="Sneaker Weiß"></oc-selection-tile-v2>
<p class="demo-label">fill-parent</p>
<oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">XL</label><input type="checkbox" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="container" width-behavior="fill"><div slot="content" style="padding:8px"><img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="" style="display:block;width:100%;height:80px;object-fit:cover;border-radius:4px"></div><input type="checkbox" aria-label="Sneaker Weiß"></oc-selection-tile-v2>

color: 1.5rem × 1.5rem

image: 1.5rem × 1.5rem

LiveFitting color and image variant
HTML
<p class="demo-label">color: 1.5rem × 1.5rem</p>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="checkbox" aria-label="Mint"></oc-selection-tile-v2>
<p class="demo-label">image: 1.5rem × 1.5rem</p>
<oc-selection-tile-v2 variant="image" img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="checkbox" aria-label="Weiß"></oc-selection-tile-v2>

Swatch 1.5rem, hitbox 2rem, 8px apart

LiveHitbox
HTML
<p class="demo-label">Swatch 1.5rem, hitbox 2rem, 8px apart</p>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="radio" name="st-hit" aria-label="Mint"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="radio" name="st-hit" aria-label="Mint 2"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="radio" name="st-hit" aria-label="Mint 3"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="radio" name="st-hit" aria-label="Mint 4"></oc-selection-tile-v2>
<oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-mint)"><input type="radio" name="st-hit" aria-label="Mint 5"></oc-selection-tile-v2>

Placement

When placing multiple selection tiles horizontally or vertically next to each other, ensure there is at least a 8px gap between them.

8px gap in both directions

LivePlacement
HTML
<p class="demo-label">8px gap in both directions</p>
<div class="gap-8" style="display:grid;grid-template-columns:repeat(2,max-content)">
<oc-selection-tile-v2><label slot="content">36</label><input type="radio" name="st-place" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2><label slot="content">38</label><input type="radio" name="st-place" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2><label slot="content">40</label><input type="radio" name="st-place" aria-label="oc-auto"></oc-selection-tile-v2>
<oc-selection-tile-v2><label slot="content">42</label><input type="radio" name="st-place" aria-label="oc-auto"></oc-selection-tile-v2>

Best practices

Geschenkverpackung
Wir packen deinen Artikel als Geschenk ein.
Grußkarte
Wir legen eine Karte mit deinem Text bei.
DoUse selection signifier to emphasize the interactivity and variant of selection tiles. They represent the selection tile's state.
Wir packen deinen Artikel als Geschenk ein.
Wir legen eine Karte mit deinem Text bei.
Don'tUse checkboxes or radio buttons within selection tiles. This creates confusion about the actual state and leads to errors.
Geschenkverpackung
Wir packen deinen Artikel als Geschenk ein.
So sieht die Verpackung aus
CautionYou can use other interactive components, such as links, inside selection tiles, but be careful of the overlaying touch areas.

Accessibility

Implementation

Live demo

Sneaker in Weiß

Sneaker

Low-Top Sneaker aus Leder

79,99 € 99,99 €

Farbe: Weiß

Größe

In den Warenkorb
LiveReal OTTO components, rendered by the OTTO component runtime
HTML
<div style="max-width:760px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));gap:32px;align-items:start">
<div style="position:relative;border-radius:12px;overflow:hidden;background:var(--oc-semantic-color-background-frame,#f0f0f0)">
  <img src="/previews/imagery/samples/otto-product-still/product-sneaker.webp" alt="Sneaker in Weiß" style="display:block;width:100%;aspect-ratio:1;object-fit:cover">
  <div style="position:absolute;top:12px;right:12px"><oc-icon-button-v3 variant="secondary-over-color" size="100" icon="wishlist" oc-aria-label="Merken"></oc-icon-button-v3></div>
<div style="display:grid;gap:20px">
  <div style="display:grid;gap:4px">
    <p class="oc-copy-75 oc-text-color-secondary">Sneaker</p>
    <p class="oc-headline-100">Low-Top Sneaker aus Leder</p>
    <p class="oc-headline-100" style="color:var(--oc-semantic-color-text-sale,#c4002b)">79,99 € <span class="oc-copy-75 oc-text-color-secondary" style="font-weight:400;text-decoration:line-through">99,99 €</span></p>
  <div style="display:grid;gap:8px">
    <p class="oc-copy-100"><b>Farbe:</b> Weiß</p>
      <oc-selection-tile-v2 variant="image" img-src="/previews/imagery/samples/otto-product-still/product-sneaker.webp"><input type="radio" name="pdp-color" checked aria-label="Weiß"></oc-selection-tile-v2>
      <oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-beige)"><input type="radio" name="pdp-color" aria-label="Beige"></oc-selection-tile-v2>
      <oc-selection-tile-v2 variant="color" color="var(--oc-semantic-color-background-block-blue)"><input type="radio" name="pdp-color" aria-label="Hellblau"></oc-selection-tile-v2>
      <oc-selection-tile-v2 variant="color" strike-through color="var(--oc-semantic-color-background-block-pink)"><input type="radio" name="pdp-color" disabled aria-label="Rosa, ausverkauft"></oc-selection-tile-v2>
  <div style="display:grid;gap:8px">
    <p class="oc-copy-100"><b>Größe</b></p>
    <div class="gap-8" role="radiogroup" aria-label="Größe" style="display:grid;grid-template-columns:repeat(4,1fr)">
      <oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">38</label><input type="radio" name="pdp-size" aria-label="oc-auto"></oc-selection-tile-v2>
      <oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">39</label><input type="radio" name="pdp-size" checked aria-label="oc-auto"></oc-selection-tile-v2>
      <oc-selection-tile-v2 width-behavior="fill" strike-through><label slot="content" style="display:block;width:100%;text-align:center">40</label><input type="radio" name="pdp-size" disabled aria-label="oc-auto"></oc-selection-tile-v2>
      <oc-selection-tile-v2 width-behavior="fill"><label slot="content" style="display:block;width:100%;text-align:center">41</label><input type="radio" name="pdp-size" aria-label="oc-auto"></oc-selection-tile-v2>
  <oc-button-v1 variant="primary" icon-type-left="basket">In den Warenkorb</oc-button-v1>

Code

Version Tag Status API
v2 <oc-selection-tile-v2> Stable SelectionTileV2
v1 <oc-selection-tile-v1> Deprecated SelectionTileV1

API

API: <oc-selection-tile-v2> (SelectionTileV2)

The Selection Tile component allows users to select one or more options with various visual representations. Supports multiple variants (text, color, image, and container) for different use cases like size selection, color picking, and product variants.

Attributes / properties
Attribute Type Default Required Description
variant "text" | "color" | "container" | "image" "text" no The main styling and behavior variant of the selection tile. - text: Displays text content from the default slot - color: Displays a colored circle using the color attribute - image: Displays an image using the img-src attribute - container: Displays custom content from the default slot with container styling
color string undefined no Deprecated: The attribute color is deprecated. Please use the CSS-Variable --color instead.

The color value of the selection tile displayed as a circular swatch. Accepts any valid CSS color value, including hex codes (e.g., #FFDDD2), RGB values, or CSS gradients. Only applies when variant="color".
img-src string undefined no The URL of the image to display. This attribute applies only when variant="image".
strike-through boolean false no Indicates whether the selection tile displays a diagonal strike-through line. When true, overlays a 45-degree line across the content to indicate unavailable or discontinued options. When false, displays normal content without any strike-through. Compatible with all variants.
width-behavior "fill" | "fit" "fit" no Defines the width behavior of the radio button component. - "fill": The component expands to fill the available width. - "fit": The component width fits its content.

Only applies when variant="container" or variant="text".
Slots
Slot Required Description
default yes Requires one of the following interactive elements: - <input type="checkbox"> for multi-selection - <input type="radio"> for single-selection

For more information on interactive components, refer to the interactive component slots documentation.
content no The text or HTML content displayed inside the selection tile. For variant="text", typically contains a <label slot="content"> element with the option text. For variant="container", can contain any custom HTML markup such as images, icons, or complex layouts. Not used for variant="color" or variant="image" as these variants display colors and images via attributes.
Events
Event Detail type Description
oc-property-change OcSelectionTileV2Events["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
--color undefined The color value of the selection tile displayed as a circular swatch. Accepts any valid CSS color value, including hex codes (e.g., #FFDDD2), RGB values, or CSS gradients. Only applies when variant="color" is set.

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

Examples

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

Default

The default text variant displaying a simple label. Use this variant for text-based options like clothing sizes, measurements, or short descriptive labels. The text content is provided via the default slot, typically wrapped in a <label slot="content"> element.

HTML
<oc-selection-tile-v2 variant="text">
<label slot="content">label</label>
<input type="checkbox" aria-label="oc-auto"/>
</oc-selection-tile-v2>
Color

The color variant displays a circular color swatch using the --color CSS variable. Ideal for color selection use cases where users need to choose from available product colors. Accepts any valid CSS color value including hex codes, RGB, HSL, or named colors. Since there's no visible text, the input element must include a descriptive aria-label for accessibility. Content in the default slot is not displayed in this variant.

HTML
<oc-selection-tile-v2 variant="color" style="--color: #ffddd2">
<input type="checkbox" aria-label="Example of a selection tile of variant color with a peachy pink color"/>
</oc-selection-tile-v2>
Color with gradient

The color variant with CSS gradient support. Demonstrates how to use CSS linear gradients for more complex color patterns. Accepts any valid CSS gradient syntax including linear-gradient, radial-gradient, and conic-gradient. Perfect for showing multicolor or patterned options. Since there's no visible text, the input element must include a descriptive aria-label for accessibility.

45deg, #D94543 15%, #CFCF4D 30%, #69CB64 45%, #2A86B4 60%, #5F5FD0 75%, #DA67DA 90% )`

HTML
<oc-selection-tile-v2 variant="color" style="--color: linear-gradient(
45deg,
#d94543 15%,
#cfcf4d 30%,
#69cb64 45%,
#2a86b4 60%,
#5f5fd0 75%,
#da67da 90%
)">
<input type="checkbox" aria-label="Rainbow gradient"/>
</oc-selection-tile-v2>
Image

The image variant displays a circular image using the img-src attribute. Ideal for showing product variants, patterns, textures, or visual previews. The image is automatically cropped to a circular shape and centered. Since there's no visible text, the input element must include a descriptive aria-label for accessibility. Content in the default slot is not displayed in this variant.

HTML
<oc-selection-tile-v2 variant="image" img-src="https://www.otto.de/assets-storybook/assets/img-placeholder-100.DVwSxVZf.png">
<input type="checkbox" aria-label="Example of a selection tile of variant image with a placeholder image"/>
</oc-selection-tile-v2>
Strike through

The text variant with strike-through enabled. Displays a diagonal line across the selection tile to indicate unavailable, out-of-stock, or discontinued options. The strike-through automatically adjusts to the tile's dimensions. Users can still interact with struck-through tiles unless they are also disabled.

HTML
<oc-selection-tile-v2 strike-through>
<label slot="content">label</label>
<input type="checkbox" aria-label="oc-auto"/>
</oc-selection-tile-v2>
Strike through color

The color variant with strike-through enabled. Demonstrates how the strike-through indicator works with color swatches. Useful for showing discontinued or unavailable color options.

HTML
<oc-selection-tile-v2 variant="color" strike-through style="--color: #ffddd2">
<input type="checkbox" aria-label="Example of a selection tile of variant color with a peachy pink color and a strike-through"/>
</oc-selection-tile-v2>
Older versions

Migration to v2

Migration from selection tile v1 to v2

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

Skip to:

What's new
Native input element

The component now uses a native <input> element, providing:

  • Better form integration and native form submission
  • Native validation support
  • Improved accessibility with screen readers
  • Support for standard input attributes like autofocus, form, formnovalidate
Selection behavior via input type
  • Use <input type="checkbox"> for multi-selection (multiple tiles can be selected)
  • Use <input type="radio"> with matching name attributes for single-selection (only one tile in the group can be selected)
Events

All native input events are now available:

  • click
  • input
  • change
  • focus
  • blur
Flexible content

The content slot allows for more flexible content, including HTML elements:

Custom option
HTML
<oc-selection-tile-v2 variant="container">
<input type="checkbox" name="option" value="custom" aria-label="oc-auto" />
<div slot="content" style="display: flex; flex-direction: column; gap: 8px; padding: 16px;">
  <oc-icon-v1 type="wishlist" size="100"></oc-icon-v1>
  <span class="oc-copy-125">Custom option</span>
</oc-selection-tile-v2>
API changes
Changed attributes
v1 Attribute v2 Attribute Notes
fill-parent width-behavior="fill" Default is "fit"
variant variant No change
color color No change
img-src img-src No change
strike-through strike-through No change
Changed slots
v1 Slot v2 Slot Notes
default (content) content Content now uses the content slot
— default Now contains the native <input> element
Removed attributes

The following attributes have been removed and should now be set on the native <input> element:

v1 Attribute v2 Equivalent Notes
checked Set checked on the <input> element Moved to native input
disabled Set disabled on the <input> element Moved to native input
name Set name on the <input> element Moved to native input
value Set value on the <input> element Moved to native input
oc-aria-label Set aria-label on the <input> element Renamed to standard attribute
single-selection Use <input type="radio"> instead of <input type="checkbox"> Use appropriate input type
Removed CSS variables
v1 CSS Variable v2 Equivalent Notes
--color Use the color attribute instead Replaced with attribute
How to migrate

The main change is that v2 uses a native <input> element in the default slot instead of managing the selection state internally. Use type="checkbox" for multi-selection scenarios or type="radio" for single-selection scenarios. This provides better accessibility, form integration, and native event support.

Migrate the text variant (multi-selection)
<!-- From: -->
<oc-selection-tile-v1 variant="text" name="size" value="M">M</oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2 variant="text">
  <input type="checkbox" name="size" value="M" aria-label="oc-auto" />
  <label slot="content">M</label>
</oc-selection-tile-v2>
Migrate the text variant (single-selection)
<!-- From: -->
<oc-selection-tile-v1 variant="text" name="size" value="M" single-selection>M</oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2 variant="text">
  <input type="radio" name="size" value="M" aria-label="oc-auto" />
  <label slot="content">M</label>
</oc-selection-tile-v2>
Migrate the color variant
<!-- From: -->
<oc-selection-tile-v1
  variant="color"
  color="#ffddd2"
  name="color"
  value="peachy"
  oc-aria-label="Peachy pink"
></oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2 variant="color" color="#ffddd2">
  <input type="checkbox" name="color" value="peachy" aria-label="Peachy pink" />
</oc-selection-tile-v2>
Migrate the image variant
<!-- From: -->
<oc-selection-tile-v1
  variant="image"
  img-src="/path/to/image.png"
  name="product"
  value="variant-1"
  oc-aria-label="Product variant 1"
></oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2 variant="image" img-src="/path/to/image.png">
  <input type="checkbox" name="product" value="variant-1" aria-label="Product variant 1" />
</oc-selection-tile-v2>
Migrate the container variant
<!-- From: -->
<oc-selection-tile-v1 variant="container" name="option" value="custom">
  <div>Custom content</div>
</oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2 variant="container">
  <input type="checkbox" name="option" value="custom" aria-label="oc-auto" />
  <div slot="content">Custom content</div>
</oc-selection-tile-v2>
Migrate a selection tile with a disabled state
<!-- From: -->
<oc-selection-tile-v1 disabled>Label</oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2>
  <input type="checkbox" disabled aria-label="oc-auto" />
  <label slot="content">Label</label>
</oc-selection-tile-v2>
Migrate a selection tile with width behavior
<!-- From: -->
<oc-selection-tile-v1 fill-parent>Full width</oc-selection-tile-v1>
<!-- To: -->
<oc-selection-tile-v2 width-behavior="fill">
  <input type="checkbox" aria-label="oc-auto" />
  <label slot="content">Full width</label>
</oc-selection-tile-v2>
Migrate a group of single-selection tiles
<!-- From: -->
<fieldset>
  <legend>Size</legend>
  <oc-selection-tile-v1 variant="text" name="size" value="S" single-selection
    >S</oc-selection-tile-v1
  >
  <oc-selection-tile-v1 variant="text" name="size" value="M" single-selection
    >M</oc-selection-tile-v1
  >
  <oc-selection-tile-v1 variant="text" name="size" value="L" single-selection
    >L</oc-selection-tile-v1
  >
</fieldset>
<!-- To: -->
<fieldset role="radiogroup" aria-label="Size">
  <oc-selection-tile-v2 variant="text">
    <input type="radio" name="size" value="S" aria-label="oc-auto" />
    <label slot="content">S</label>
  </oc-selection-tile-v2>
  <oc-selection-tile-v2 variant="text">
    <input type="radio" name="size" value="M" aria-label="oc-auto" />
    <label slot="content">M</label>
  </oc-selection-tile-v2>
  <oc-selection-tile-v2 variant="text">
    <input type="radio" name="size" value="L" aria-label="oc-auto" />
    <label slot="content">L</label>
  </oc-selection-tile-v2>
</fieldset>

API v1

API: <oc-selection-tile-v1> (SelectionTileV1)

The Selection Tile component provides an interactive tile with properties for setting the variant, disabled state, initial checked state, and form identification and processing values. It supports both single and multi-selection behaviors, acting as a radio button for single selections and a checkbox for multiple selections.

Attributes / properties
Attribute Type Default Required Description
variant "text" | "color" | "container" | "image" "text" no Sets the main styling and behavior of the selection tile. Can be one of: color, container, image, text.
single-selection boolean false no Specifies whether only one selection tile can be selected at once. Requires the attributes name and value to be set.
value string "on" no Specifies the value of a checked selection tile for form processing. If this attribute is not specified, the default value on is used as the submitted data.

Mandatory if single-selection is active.
color string undefined no Deprecated: The attribute color is deprecated. Please use the CSS-Variable --color instead.

The color value of the selection tile displayed as a circular swatch. Accepts any valid CSS color value, including hex codes (e.g., #FFDDD2), RGB values, or CSS gradients. Only applies when variant="color".
img-src string undefined no Specifies the URL of the image. This attribute only applies to variant="image".
strike-through boolean false no Specifies whether the selection tile should render a 45° diagonal line on top of the content
checked boolean no Toggles the state of the selection tile between checked and unchecked. When set to true, the selection tile is initially displayed as checked.
disabled boolean no Disables the selection tile, preventing user interaction and input.
fill-parent boolean false no Sets the width of the selection tile to match the width of the parent element.
name string undefined no Sets the name attribute to identify the selection tile when submitting a form.
oc-aria-label string undefined no Sets the ARIA label of the selection tile.
Slots
Slot Required Description
default no Sets the text content of the selection tile. This slot is only available to variant="text" and variant="container".
Events
Event Detail type Description
oc-property-change OcSelectionTileV1Events["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
--color undefined Sets the color of the selection tile.

Only applies when variant="color" is set.

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