Edit in GitHubLog an issue

sp-checkbox

Since: UXP v4.1

Renders a checkbox with associated label.

Checkboxes

See:

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 clipboard
document.querySelector(".yourCheckbox").addEventListener("change", evt => {
console.log(`Is the checkbox checked: ${evt.target.checked}`);
})
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.