6.2 forms.autocomplete Autocomplete field
As the user starts to type a value, a selection list appears below the form item allowing them to choose an option.
Examples
Default styling
- guwatif
- hichiuasl
.is-throbbing
Waiting for search result.
- guwatif
- hichiuasl
Markup: forms/autocomplete/autocomplete.twig
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"autocomplete </span></span></span><span class="hljs-template-variable">{{modifier_class}}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"autocomplete__list-wrapper"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">ul</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"autocomplete__list"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"autocomplete__list-item"</span>></span>guwatif<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"autocomplete__list-item is-selected"</span>></span>hichiuasl<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"></<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
<span class="hljs-tag"><<span class="hljs-name">p</span>></span>&nbsp;<span class="hljs-tag"></<span class="hljs-name">p</span>></span>
</span>
Source:
forms/autocomplete/_autocomplete.scss
, line 1