sp-checkbox
Since: UXP 4.1, PS 22.0.0
Renders a checkbox with associated label.
See:
- https://spectrum.adobe.com/page/checkbox/
- https://opensource.adobe.com/spectrum-web-components/components/checkbox
Example
Copied to your clipboard<sp-checkbox>Include all metadata</sp-checkbox>
States#
There are several states that are supported.
Checked#
Copied to your clipboard<sp-checkbox checked>Checked</sp-checkbox>
Indeterminate#
Copied to your clipboard<sp-checkbox indeterminate>Indeterminate</sp-checkbox>
Disabled#
Copied to your clipboard<sp-checkbox disabled>Disabled</sp-checkbox>
Invalid#
Copied to your clipboard<sp-checkbox invalid>Invalid</sp-checkbox>
Responding to events#
You can respond to changes in the checkbox using the change
or input
events.
Copied to your clipboard1document.querySelector(".yourCheckbox").addEventListener("change", evt => {2 console.log(`Is the checkbox checked: ${evt.target.checked}`);3})