Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms Form-associated

Checkbox <pm-checkbox>

Checkbox for turning an option on or off, with an optional mixed state.

Full screen
I accept the terms Email me product updates Select all files Managed by your admin

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/checkbox'; </script> <div class="pm-stack" style="gap: var(--pm-space-2)"> <pm-checkbox name="terms" required>I accept the terms</pm-checkbox> <pm-checkbox checked>Email me product updates</pm-checkbox> <pm-checkbox indeterminate>Select all files</pm-checkbox> <pm-checkbox disabled>Managed by your admin</pm-checkbox> </div>

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

I accept the terms
size="xs"
I accept the terms
size="sm"
I accept the terms
size="md"
I accept the terms
size="lg"
I accept the terms
size="xl"

Tones

Set tone on the element, or data-tone on any ancestor to tone a whole area.

I accept the terms
tone="accent"
I accept the terms
tone="secondary"
I accept the terms
tone="neutral"
I accept the terms
tone="success"
I accept the terms
tone="warning"
I accept the terms
tone="danger"
I accept the terms
tone="info"

States

Each state is one attribute.

I accept the terms
Disabled
I accept the terms
Read-only
I accept the terms
Required
I accept the terms
Indeterminate
I accept the terms
Error
I accept the terms
With a hint

Attributes

AttributeTypeDefaultDescription
checkedbooleanfalseWhether it is on (submitted with the form when on).
indeterminatebooleanfalseMixed state (neither on nor off), e.g. a "select all" with some items selected.
namestring—Form field name: the value is submitted under it.
valuestring—Current value (submitted with the form).
labelstring—Visible label (required for accessibility; use hide-label to visually hide it).
hintstring—Help text under the field, linked to it for screen readers.
errorstring—Custom error message. Setting it marks the control invalid.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'—Control size.
requiredbooleanfalseThe form cannot be submitted until this has a value.
disabledbooleanfalseNot interactive and not submitted.
readonlybooleanfalseFocusable and submitted, but not editable.
hide-label
prop: hideLabel
booleanfalseHide the label visually; it stays the accessible name.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeWhen toggled.

Slots

SlotDescription
(default)Label text.

Methods

checkValidity(), reportValidity(), validate(), focus()

Used in templates

Sign inCreate accountTwo-step verificationChoose a new passwordCheckoutContact