Forms Form-associated
Switch <pm-switch>
On/off switch (form value like a checkbox).
Sizes
Set with the size attribute; controls keep touch-sized targets on phones.
size="xs"size="sm"size="md"size="lg"size="xl"Tones
Set tone on the element, or data-tone on any ancestor to tone a whole area.
tone="accent"tone="secondary"tone="neutral"tone="success"tone="warning"tone="danger"tone="info"States
Each state is one attribute.
DisabledRead-onlyRequiredIndeterminateErrorWith a hintAttributes
| Attribute | Type | Default | Description |
|---|---|---|---|
checked | boolean | false | Whether it is on (submitted with the form when on). |
indeterminate | boolean | false | Mixed state (neither on nor off), e.g. a "select all" with some items selected. |
name | string | — | Form field name: the value is submitted under it. |
value | string | — | Current value (submitted with the form). |
label | string | — | Visible label (required for accessibility; use hide-label to visually hide it). |
hint | string | — | Help text under the field, linked to it for screen readers. |
error | string | — | Custom error message. Setting it marks the control invalid. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | — | Control size. |
required | boolean | false | The form cannot be submitted until this has a value. |
disabled | boolean | false | Not interactive and not submitted. |
readonly | boolean | false | Focusable and submitted, but not editable. |
hide-labelprop: hideLabel | boolean | false | Hide 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
| Event | React / Svelte prop | Description |
|---|---|---|
pm-change | onPmChange | When toggled. |
Slots
| Slot | Description |
|---|---|
(default) | Label text. |
Methods
checkValidity(), reportValidity(), validate(), focus()
Used in templates
Traffic analyticsInboxNotificationsTeam and rolesAccount settingsServer error (500)Onboarding wizardFeedback survey