Skip to content

Latest commit

 

History

History
105 lines (92 loc) · 4.97 KB

File metadata and controls

105 lines (92 loc) · 4.97 KB

The Customizable <select> (ex <selectlist> ⇢ ex <selectmenu> ⇢ ex <select> v2)

Opt-in mode:

select, ::picker(select) {
  appearance: base-select;
}

Alternative snippet:

select {
  appearance: none;
  @supports (appearance: base-select) {
    &,
    &::picker(select) {
      appearance: base-select;
    }
  }
}
<select class="my-custom-select">
  <div slot="button">
    <span behavior="selected-value" slot="selected-value"></span>
    <button behavior="button"></button>
  </div>
  <div slot="listbox">
    <div popover="auto" behavior="listbox">
       <option value="one">one</option>
       <option value="two">two</option>
    </div>
  </div>
</select>

image

<select>
  <button class="action-btn" type="button">
    <selectedoption>
      <span class="preview-heading">Create a merge commit</span>
      <span class="action-heading">Merge Pull Request</span>
      <span class="description">All commits from this branch will be added to the base branch via a merge commit.</span>
    </selectedoption>
  </button>
  <button class="open-list-btn" type="selectlist">
    <span class="arrow">
      <figure></figure> <!-- should be image, using this for demo shortcut only -->
    </span>
  </button>
  <listbox>
    <option value="merge-commit">
      <span class="preview-heading">Create a merge commit</span>
      <span class="action-heading">Merge Pull Request</span>
      <span class="description">All commits from this branch will be added to the base branch via a merge commit.</span>
    </option>
    <option value="squash-merge">
      <span class="preview-heading">Squash and merge</span>
      <span class="action-heading">Squash and merge</span>
      <span class="description">The 1 commit from this branch will be added to the base branch.</span>
    </option>
    <option value="rebase-merge">
      <span class="preview-heading">Rebase and merge</span>
      <span class="action-heading">Rebase and merge</span>
      <span class="description">The 1 commit from this branch will be rebased and added to the base branch.</span>
    </option>
  </listbox>
</select>

Mode multiple