Moey Icons
No results. Try “dialog”, “dark” or “grid”.
Forms

Form layout

The shapes admin forms keep needing: a simple stack, fields side by side, labels on the left, settings sections, a filter bar, and a save bar that knows when there are unsaved changes.

Stack and columns

.form-stack spaces fields evenly. For fields side by side, use the grid: each .field takes a span, full width on phones.

<form class="form-stack">
  <div class="grid g-3">
    <div class="field span-12 sm:span-6">…First name…</div>
    <div class="field span-12 sm:span-6">…Last name…</div>
  </div>
  <div class="field">…Email…</div>
  <div class="form-actions">
    <button type="button" class="btn">Cancel</button>
    <button class="btn btn-default">Save customer</button>
  </div>
</form>

Labels on the left

.form-horizontal puts each label beside its field from 768px up (on phones they stack). Hints and errors line up under the field. --mo-form-label-width sets the label column (12rem).

https://.shop
Customers see this in their browser.
Notifications
<form class="form-horizontal form-stack">
  <div class="field">
    <label class="form-label" for="name">Store name</label>
    <input class="form-control" id="name">
  </div>
  …
  <div class="form-actions"><button class="btn btn-default">Save</button></div>
</form>

Settings sections and unsaved changes

.form-section: a title and description on the left, fields on the right (stacked below 992px). data-moey-dirty on the form tracks unsaved changes — change something and the save bar appears; Discard puts it back; leaving the page while it has changes asks first.

Profile

How your shop appears to customers.

Orders

What happens when someone buys.

You have unsaved changes
<form data-moey-dirty>
  <section class="form-section">
    <div class="form-section-header">
      <h3>Profile</h3>
      <p>How your shop appears to customers.</p>
    </div>
    <div class="form-section-body">…fields…</div>
  </section>
  …
  <div class="form-actions form-actions-sticky form-actions-dirty">
    <span class="form-actions-note">You have unsaved changes</span>
    <button type="reset" class="btn btn-ghost">Discard</button>
    <button class="btn btn-default">Save changes</button>
  </div>
</form>

<script>
  // Saved with fetch instead of a normal submit? Tell Moey it's clean again:
  form.addEventListener('submit', async (e) => { e.preventDefault(); await save(form); Moey.clean(form); });
  form.addEventListener('moey:dirty', (e) => e.detail.dirty);
</script>

Filter bar

.form-inline puts fields in a row that wraps on small screens; buttons line up with the fields.

<form class="form-inline">
  <div class="field">…Search…</div>
  <div class="field">…Status…</div>
  <button class="btn btn-default">Filter</button>
</form>
Class / attributeWhat it does
.form-stackFields one under another (--mo-form-gap, 1rem)
.grid + .span-12 .sm:span-6Fields side by side — see Grid
.form-horizontal · .field-horizontalLabels on the left from 768px (--mo-form-label-width)
.form-section > .form-section-header + .form-section-bodySettings sections, title on the left from 992px
.form-inlineA wrapping row of fields and buttons
.form-actions · -sticky · -start · .form-actions-noteThe buttons (right-aligned; full-width on phones) · stuck to the bottom of the screen · left-aligned · a note on the left
data-moey-dirty · .form-actions-dirtyTrack unsaved changes (.is-dirty, moey:dirty, a warning before leaving) · show the bar only then
Moey.clean(form)Mark it saved after saving it yourself