# The data-source Convention

> Components read options from a hidden select: groups, values, and data-* configuration.

Data-driven components read a hidden `<select data-fn="data-source">` placed inside them. Optgroups become groups, options become items, and `data-*` attributes on options carry extra configuration.

```html
<button type="button" class="z-button z-button-secondary" data-toggle="#cmd-data-source">Open palette</button>

<z-cmd id="cmd-data-source">
  <select data-fn="data-source" hidden>
    <optgroup label="Documents">
      <option value="report" data-keywords="quarterly, finance" data-description="Q4 summary" data-kbd="⌘+R">
        Report
      </option>
      <option value="invoice" data-icon="book">Invoice</option>
    </optgroup>
    <option value="scratch">Scratch pad</option>
  </select>
</z-cmd>
```

| Option attribute | Meaning |
| --- | --- |
| `value` | Identifier emitted in select events. |
| `disabled` | Non-selectable; skipped by keyboard navigation. |
| `selected` | Initially selected. |
| `data-keywords` | Extra comma-separated search terms. |
| `data-description` | Secondary line under the label; also searched. |
| `data-icon` | Icon key resolved through the icon repositories. |
| `data-kbd` | Keycap hint: `+` joins keys, spaces separate them. |
| `data-shortcut` | Alternative keycap hint when `data-kbd` is absent. |

> **Tip:** Add `data-reactive` to the select to re-parse it automatically when its DOM changes.
