observablehq/inputs

Support optgroup in Inputs.select

tophtucker opened this issue · 2 comments

Maybe niche, but I just found myself wanting to be able to specify groups of options, so, like,

Inputs.select({
  group1: ["a", "b", "c"], 
  group2: ["x", "y", "z"]
})

could produce

<select>
  <optgroup label="group1">
    <option>a</option>
    <option>b</option>
    <option>c</option>
  </optgroup>
  <optgroup label="group2">
    <option>x</option>
    <option>y</option>
    <option>z</option>
  </optgroup>
</select>

See also #94

Ha oops! (I promise I tried searching, but who knows for what…)