Skip to content

Checkbox

Use Checkbox to let a shopper pick one or more options from a list or mark a single item as selected. It renders a labeled checkbox with an optional secondary description.

The SDK Checkbox showing a selected checkbox with a label.
import { Checkbox } from '/@dropins/tools/components.js';
PropTypeReq?Description
namestringYesField name, used to map the value in a form.
labelstring | VNode | VNode[]NoLabel for the checkbox.
descriptionstring | VNode | VNode[]NoAdditional secondary description. Accepts a string or nodes.
size'medium' | 'large'NoSize of the label and description text. Defaults to medium.
disabledbooleanNoDisable the checkbox. Defaults to false.
errorbooleanNoRender the error state. Defaults to false.

Checkbox also accepts standard input HTML attributes (for example, checked, value, and onChange), except size and label.

Render a checkbox with a label, a description, and a change handler.

import { Checkbox, provider } from '/@dropins/tools/components.js';
await provider.render(Checkbox, {
name: 'newsletter',
label: 'Sign me up for the newsletter',
description: 'Optional description text goes here.',
onChange: (event) => yourUpdateSubscription(event.currentTarget.checked),
})(document.querySelector('.checkbox'));
  • RadioButton — for selecting a single option from a set.
  • Field — wrap form controls with labels and validation.