Configurator
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>Usage
Anatomy
- Container
- Placeholder
- Search icon (empty field)
- Input
- Clear button
- Search button
HTML
<div class="anatomy" style="display:block">
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<span class="anatomy-pin" style="left:0;top:50%">1</span>
<span class="anatomy-pin" style="left:30%;top:-14px">2</span>
<span class="anatomy-pin" style="left:calc(100% - 26px);top:-14px">3</span>
<div class="anatomy" style="display:block">
<oc-search-field-v1><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<span class="anatomy-pin" style="left:18%;top:-14px">4</span>
<span class="anatomy-pin" style="left:calc(100% - 76px);top:-14px">5</span>
<span class="anatomy-pin" style="left:calc(100% - 26px);top:-14px">6</span>
<ol class="anatomy-key"><li data-n="1">Container</li><li data-n="2">Placeholder</li><li data-n="3">Search icon (empty field)</li><li data-n="4">Input</li><li data-n="5">Clear button</li><li data-n="6">Search button</li></ol>Variants
By default, the search field comes with stacked-background, but it is also available as over-color variant with canvas-background. The over-color variant can be used on frame or on colored blocks.
Default, on canvas
over-color, on frame
HTML
<p class="demo-label">Default, on canvas</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">over-color, on frame</p>
<oc-search-field-v1 over-color><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
The search button is optional and can be hidden. If you want to show the search button you can choose between secondary or primary.
search-button-type secondary
search-button-type primary
search-button-type none
HTML
<p class="demo-label">search-button-type secondary</p>
<oc-search-field-v1 search-button-type="secondary"><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">search-button-type primary</p>
<oc-search-field-v1 search-button-type="primary"><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">search-button-type none</p>
<oc-search-field-v1 search-button-type="none"><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
The placeholder of the search is "Wonach suchst du?" per default, but can be edited. It is hidden as soon as input is provided.
Default placeholder
Custom placeholder
HTML
<p class="demo-label">Default placeholder</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">Custom placeholder</p>
<oc-search-field-v1><input type="search" placeholder="Nach Marken suchen" spellcheck="false"></oc-search-field-v1>
Behavior
States
Empty (hover and focus it)
Filled
over-color, empty
over-color, filled
HTML
<p class="demo-label">Empty (hover and focus it)</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">Filled</p>
<oc-search-field-v1><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">over-color, empty</p>
<oc-search-field-v1 over-color><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">over-color, filled</p>
<oc-search-field-v1 over-color><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
Interaction
Clicking or tapping on the search field focuses the search field. While typing, the clear and search buttons are shown. The clear button deletes the input, but this can also be done using the ESC key. The search button submits the input, but this can also be done by pressing the ENTER key. If the text exceeds the size of the input field, it slides out to the left to prevent it from being abbreviated. The input is not checked by a spellchecker.
1 · click/tap to focus
2 · type
3 · click/tap ⓧ to delete, 🔍 to send
HTML
<p class="demo-label">1 · click/tap to focus</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">2 · type</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">3 · click/tap ⓧ to delete, 🔍 to send</p>
<oc-search-field-v1><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
1 · TAB to focus
2 · type
3 · ESC to delete, SPACE or ENTER to send
HTML
<p class="demo-label">1 · TAB to focus</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">2 · type</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<p class="demo-label">3 · ESC to delete, SPACE or ENTER to send</p>
<oc-search-field-v1><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
Long input scrolls inside the field
HTML
<p class="demo-label">Long input scrolls inside the field</p>
<oc-search-field-v1><input type="search" value="Das hier ist ein sehr, sehr, sehr langer Input." placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
Fitting
The search field width uses fill-parent. The height is fixed.
Width: fill-parent · height: 1.5rem + 2 × 12px
HTML
<p class="demo-label">Width: fill-parent · height: 1.5rem + 2 × 12px</p>
<oc-search-field-v1><input type="search" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
Placement
By default, place the search field on canvas. To place it on frame or colored blocks use the over-color variant.
Best Practices
Accessibility
By default, the search button has the aria-label "Suche abschicken," and the clear button has the aria-label "Suchbegriff löschen." These labels can be edited.
- aria-label: Suchbegriff löschen
- aria-label: Suche abschicken
HTML
<div class="anatomy" style="display:block;max-width:360px;margin:28px auto">
<oc-search-field-v1 clear-button-aria-label="Suchbegriff löschen" search-button-aria-label="Suche abschicken"><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<span class="anatomy-pin" style="left:calc(100% - 76px);top:-14px">1</span>
<span class="anatomy-pin" style="left:calc(100% - 26px);top:calc(100% + 14px)">2</span>
<ol class="anatomy-key"><li data-n="1">aria-label: Suchbegriff löschen</li><li data-n="2">aria-label: Suche abschicken</li></ol>The focus order of the search field is as follows:
- Input field
- Clear button
- Search button (tab through it)
HTML
<div class="anatomy" style="display:block;max-width:360px;margin:28px auto">
<oc-search-field-v1><input type="search" value="Sneaker" placeholder="Wonach suchst du?" spellcheck="false"></oc-search-field-v1>
<span class="anatomy-pin" style="left:0;top:50%">1</span>
<span class="anatomy-pin" style="left:calc(100% - 76px);top:-14px">2</span>
<span class="anatomy-pin" style="left:calc(100% - 26px);top:-14px">3</span>
<ol class="anatomy-key"><li data-n="1">Input field</li><li data-n="2">Clear button</li><li data-n="3">Search button (tab through it)</li></ol>For more information on accessibility, refer to the technical documentation.
Status
Implementation
Note: For full technical documentation of this component, visit Storybook/Search field.
Live demo
Vorschläge
Beliebt bei OTTO
HTML
<div style="max-width:560px;margin:0 auto;display:grid;gap:24px">
<div class="on-frame" style="margin:0;padding:16px;border-radius:12px;display:grid;gap:16px">
<oc-search-field-v1 over-color><input type="search" value="Sneak" placeholder="Wonach suchst du?" spellcheck="false" aria-label="Suche"></oc-search-field-v1>
<div style="display:grid;gap:8px">
<p class="oc-copy-75 oc-text-color-secondary" style="font-weight:700">Vorschläge</p>
<div>
<oc-row-v2 as-button hide-divider icon-left="search" icon-right="arrow-right">Sneaker Damen</oc-row-v2>
<oc-row-v2 as-button icon-left="search" icon-right="arrow-right">Sneaker Herren</oc-row-v2>
<oc-row-v2 as-button icon-left="search" icon-right="arrow-right">Sneaker weiß</oc-row-v2>
<div style="display:grid;gap:12px">
<p class="oc-copy-75 oc-text-color-secondary" style="font-weight:700">Beliebt bei OTTO</p>
<oc-chip-v3><button>Sofa</button></oc-chip-v3>
<oc-chip-v3><button>Kopfhörer</button></oc-chip-v3>
<oc-chip-v3><button>Sessel</button></oc-chip-v3>
<oc-chip-v3><button>Waschmaschine</button></oc-chip-v3>