Components/Forms/Checkbox
COMPONENT07.07

Checkbox

Native checkbox in shadcn geometry. Wrapping labels give a full-row hit area; hints and errors wire through [data-field].


INSTALL

1pnpm dlx @sayagodev/mo add form

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

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

EXAMPLES

Basic
With description
By clicking this checkbox, you agree to the terms and conditions.
Disabled
Group
Show these items on the desktop:

Select the items you want to show on the desktop.

Invalid
Accept the terms and conditions to continue.
In a table
Name Email Role
Sarah Chen [email protected] Admin
Marcus Rodriguez [email protected] User
Priya Patel [email protected] User
David Kim [email protected] Editor

USAGE

1<label><input type="checkbox" checked /> Accept terms</label>2 3<!-- title + description -->4<div class="flex items-start gap-2">5  <input type="checkbox" id="cb" />6  <div class="vstack gap-1">7    <label for="cb">Title</label>8    <small class="text-light">Description.</small>9  </div>10</div>

API

NAMEKINDDESCRIPTION
input[type=checkbox]element1rem rounded box, primary check mask
checked / disabledattributeNative states, styled
[data-field]attributeReveals small.error on aria-invalid
labelelementinline-flex row when wrapping a control

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

Your CSS

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