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

Switch <pm-switch>

On/off switch (form value like a checkbox).

Full screen
Email notifications

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/switch'; </script> <pm-switch checked>Email notifications</pm-switch>

Sizes

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

Email notifications
size="xs"
Email notifications
size="sm"
Email notifications
size="md"
Email notifications
size="lg"
Email notifications
size="xl"

Tones

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

Email notifications
tone="accent"
Email notifications
tone="secondary"
Email notifications
tone="neutral"
Email notifications
tone="success"
Email notifications
tone="warning"
Email notifications
tone="danger"
Email notifications
tone="info"

States

Each state is one attribute.

Email notifications
Disabled
Email notifications
Read-only
Email notifications
Required
Email notifications
Indeterminate
Email notifications
Error
Email notifications
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

Traffic analyticsInboxNotificationsTeam and rolesAccount settingsServer error (500)Onboarding wizardFeedback survey