s72
  • Field

    data-field

    <label data-field> stacks a label, a control and a hint. aria-invalid="true" on the control turns the field into an error, and the hint becomes the message.

    Basic

    html
    <article data-tone="card" style="display:grid;gap:1rem">
      <label data-field><span>Project folder</span><input value="~/code/atlas"><small>atlas reads and writes here.</small></label>
      <label data-field><span>Site URL</span><input value="http://atlas.local" aria-invalid="true"><small>Use https:// so the built pages load everywhere.</small></label>
      <label data-field><span>Note</span><textarea placeholder="Why this page exists"></textarea></label>
    </article>

    The label wraps the control, so clicking the text focuses the input without an id and a for.

    Notes