Components/Forms/Field composition
COMPONENT11.11

Field composition

Form row primitive: [data-field] owns spacing, fieldset/legend groups sections, smalls carry hints and errors.


INSTALL

1pnpm dlx @sayagodev/mo add form

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/form.css";

EXAMPLES

Checkout form
Payment Method

All transactions are secure and encrypted.

Enter your 16-digit card number.
Billing Address

The billing address associated with your payment method.

Notification groups
Responses

Get notified when ChatGPT responds to requests that take time, like research or image generation.

Tasks

Get notified when tasks you've created have updates. Manage tasks

Username & password
Choose a unique username for your account.
Must be at least 8 characters long.
Checkbox list
Show these items on the desktop

Select the items you want to show on the desktop.


Radio plan picker
Subscription Plan

Yearly and lifetime plans offer significant savings.

Department select
Select your department or area of work.
Switch row
Price range
Price Range

Set your budget range ($200 – $800).

Mò renders one native slider; dual-thumb ranges are not supported.
Feedback textarea
Share your thoughts about our service.
Address fieldset
Address Information

We need your address to deliver your order.

Profile form
Profile

Fill in your profile information.

Provide your full name for identification.
Choice cards
Compute Environment Select the compute environment for your cluster.

USAGE

1<fieldset>2  <legend>Section</legend>3  <div data-field>4    <label for="id">Label</label>5    <input id="id" />6    <small data-hint>Hint</small>7  </div>8</fieldset>

API

NAMEKINDDESCRIPTION
[data-field]attributeColumn flex wrapper, owns all spacing
fieldset > legendelementSection title in a bordered group
small[data-hint]elementMuted description/hint line
.row / .col-*classResponsive multi-column field grids
.hstack / .vstackclassHorizontal rows, stacked sections

FILES

src/css/form.css
Install:mo add form

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--background--border--destructive--foreground--input--muted--muted-foreground--primary--primary-foreground--radius--ring
Component hooks
--mo-field-gap--mo-input-padding-x--mo-input-radius--mo-slider-thumb-bg--mo-switch-thumb--mo-switch-width

Preview

Already taken.

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.