Skip to content

Groups and rich options ​

Groups ​

<optgroup> elements become group headers. A disabled group disables its options.

html
<select name="timezone" data-flow-select>
  <optgroup label="Europe">
    <option value="Europe/Berlin">Berlin</option>
    <option value="Europe/Paris">Paris</option>
  </optgroup>
  <optgroup label="Asia">
    <option value="Asia/Tokyo">Tokyo</option>
  </optgroup>
</select>

Descriptions ​

Add data-description to show a second line that wraps.

html
<option value="fast" data-description="Faster processing, pay as you go">Fast</option>

Avatars, meta text and badges ​

AttributeShows
data-avatarAn image when the value is a URL (https://..., /path, data:), otherwise up to two letters
data-metaSmall muted text under the label, such as an email
data-badgeA small rounded tag, such as a role
html
<option value="maya" data-avatar="/avatars/maya.jpg" data-meta="maya@example.com" data-badge="Admin">
  Maya Patel
</option>

The avatar also appears in the closed control.

Disabled options ​

The native disabled attribute works. Disabled options are shown faded, skipped by the keyboard and cannot be chosen.

Search keywords ​

data-keywords adds extra words to search on without showing them:

html
<option value="de" data-keywords="deutschland allemagne">Germany</option>

Anything else ​

For full control over a row, use custom rendering.

Released under the MIT License.