s72
  • Filter chip

    data-chip

    <label data-chip> wraps a checkbox in a pill. Several of them make a row of filters that toggle on and off, with no JavaScript behind it.

    Basic

    Show

    html
    <fieldset>
      <legend>Show</legend>
      <p style="display:flex;flex-wrap:wrap;gap:.5rem">
        <label data-chip><input type="checkbox" checked> Pages</label>
        <label data-chip><input type="checkbox" checked> Posts</label>
        <label data-chip><input type="checkbox"> Drafts</label>
        <label data-chip><input type="checkbox"> Assets</label>
      </p>
    </fieldset>

    The checkbox is hidden behind the label and still carries the state, so the form submits as it always would.

    Notes