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

Rich text

For writing with formatting — product descriptions, notes, comments, emails. Moey uses Mob, a tiny editor from Naked Tuxedo too, and dresses it in Moey: same colors, light and dark, your brand, focus ring and code font. It outputs clean, safe HTML and works on phones.

Headings, lists, links, quotes and code — or type Markdown: #, -, **bold**.
<div class="field">
  <label class="form-label" for="body">Product description</label>
  <textarea class="form-control" id="body" name="description" data-mob placeholder="Tell people about this product…"></textarea>
</div>

Set it up, step by step

  1. Load Mob next to Moey. It is its own small package (no dependencies, about 20 KB gzipped), so pages without an editor don't pay for it. From a CDN:
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.css">
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mobtexteditor@1/mob.css">
      <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.js" defer></script>
      <script src="https://cdn.jsdelivr.net/npm/mobtexteditor@1/mob.js" defer></script>
    or with npm: npm install mobtexteditor and import 'mobtexteditor/mob.css'; import Mob from 'mobtexteditor';
  2. Add data-mob to a textarea — keep its name, label and form-control class. Mob turns it into the editor; Moey's styles make it look like your other fields.
  3. Send the form as usual. The field's value is the HTML (<p>…</p><ul>…). To edit saved text, put its HTML inside the textarea.
  4. Clean it on the server too. Mob removes scripts and unsafe links before sending, but anyone can send a form without the editor — so clean what arrives (an HTML sanitizer) before you store or show it.
  5. Show it inside .prose (see Prose), so headings, lists and quotes get the right spacing.

A smaller toolbar

For comments and notes, pick only the buttons you need with data-toolbar, and a lower starting height with data-min-height. Post this comment — it's shown below with .prose:

<form class="stack gap-3">
  <div class="field">
    <label class="form-label" for="comment">Add a comment</label>
    <textarea class="form-control" id="comment" name="comment" data-mob data-toolbar="bold italic link ul code" data-min-height="90" placeholder="Write a comment…"></textarea>
  </div>
  <div class="flex justify-end gap-2">
    <button class="btn btn-gray btn-ghost" type="reset">Cancel</button>
    <button class="btn btn-default" type="submit">Comment</button>
  </div>
</form>

Buttons: block (paragraph / headings), bold italic underline strike code link ul ol quote codeblock hr clear undo redo source, and | (a divider) or spacer.

A word count and a maximum height

data-counter="true" shows the word and character count; data-max-height lets the editor grow up to that height and then scroll — the toolbar stays on top.

Announcement
<div class="card">
  <div class="card-body stack gap-3">
    <div class="font-semibold">Announcement</div>
    <textarea class="form-control" name="announcement" data-mob data-counter="true" data-max-height="240" placeholder="What's new?"></textarea>
  </div>
</div>

From JavaScript

const editor = Mob.create('#notes', { placeholder: 'Write a note…', toolbar: 'bold italic ul link' });

editor.getHTML();                 // '<p>Call the <strong>courier</strong>…</p>'
editor.setHTML('<p>Hello</p>');
editor.on('change', (html) => autosave(html));

On a phone

The toolbar scrolls sideways and stays on top while you write; the 16px text never makes iPhones zoom.

Write a note

How it matches Moey

  • Colors, borders, the focus ring and the toolbar's pressed buttons come from Moey's tokens — they follow light / dark mode and data-mo-brand (try the brand switch on the Overview).
  • Mob's own data-theme is ignored inside Moey: the page's mode decides.
  • In a .field, a required editor that's empty turns red like the other fields.
  • In a painted area (theme-indigo-deep …) it stays a readable sheet.
  • To change one thing, set Mob's variable on .mob — for example .mob { --mob-font-size: 15px !important; }.

Reference

On the textareaWhat it does
data-mobMakes it a Mob editor (with Mob's CSS + JS on the page)
placeholder · nameThe hint while empty · the form field (its value is HTML)
data-toolbar="bold italic link …"Which buttons, in order
data-min-height · data-max-heightStarting height · grows up to this, then scrolls (pixels)
data-counter="true" · data-readonlyWord and character count · show only, no editing
Mob.create(el, options){ getHTML(), setHTML(html), on('change', fn), destroy() } — see Mob's docs