Components

Lightswitch ​

Lightswitches communicate immediate on or off state for binary settings.

Basic Usage ​

Use a lightswitch for binary settings where the current state should be immediately visible.

Sizes ​

The reduced size scale is useful when lightswitches appear in dense settings rows or supporting metadata panels.

Checked ​

Use checked state for persisted settings so the current toggle value is immediately visible.

Disabled ​

Disable the toggle when the setting is shown for context but cannot currently be changed.

Labels ​

Pair switches with clear labels when the setting needs more context than the control alone can provide.

API ​

Slots ​

NameDescription
(default)Switch label
instructionsInstructions text (or use instructions attribute)
hintAlias for instructions

Attributes & Properties ​

NameDescription
checkedType boolean
Default false
customError custom-errorCustom validation message; also settable via setCustomValidity().
Type string | null
Default null
defaultChecked default-checkedType boolean
Default false
disabledDisables the control and excludes it from constraint validation.
Type boolean
Default false
instructionsType string
invalidType boolean
Default false
labelType string
nameName submitted with form data.
Type string | null
Default null
requiredMarks the control as required for form submission.
Type boolean
Default false
sizeType PkLightswitchSize
Default default
valueType string
Default on

Methods ​

NameDescription
checkValidity()Runs constraint validation without showing the browser UI.
reportValidity()Runs constraint validation and shows the browser UI when invalid.
resetValidity()Clears custom errors and re-syncs validity state.
setCustomValidity(message: string)Sets or clears a custom validation message.

Events ​

NameDescription
change—
input—
pk-change—

Custom States ​

NameDescriptionCSS selector
disabledThe control is disabled.:state(disabled)
invalidThe control currently fails constraint validation.:state(invalid)
optionalThe control is not required.:state(optional)
requiredThe control is required.:state(required)
user-invalidInvalid after the user has interacted with the control.:state(user-invalid)
user-validValid after the user has interacted with the control.:state(user-valid)
validThe control currently passes constraint validation.:state(valid)

CSS Parts ​

NameDescriptionCSS selector
baseRoot wrapper::part(base)
inputHidden checkbox input::part(input)
instructionsInstructions text::part(instructions)
labelLabel text::part(label)
switchSwitch button::part(switch)
thumbThumb element::part(thumb)
Edit this page
Last updated: Sep 9, 2026, 7:18 PM