Migrate to the Polaris consent checkbox component
The Polaris consent checkbox component renders a checkbox tied to a customer consent policy. It replaces the previous ConsentCheckbox component and is available as <s-consent-checkbox> in API versions 2025-10 and newer.
Anchor to Updated propertiesUpdated properties
The following properties are different in the Polaris consent checkbox component.
Anchor to togglestoggles
The previous ConsentCheckbox toggles prop has been replaced with command and commandFor.
| Previous pattern | New pattern | Migration notes |
|---|---|---|
toggles="details-id" | command="--toggle" + commandFor="details-id" | Disclosure behavior now uses the command pattern. |
The example below pairs the consent checkbox with an optional <s-details> panel disclosed by the command pattern. The <s-details> element isn't required by the migration — use it when you want a related details panel that opens when the checkbox is checked.
Migrating toggles to command
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<>
<s-consent-checkbox
policy="sms-marketing"
command="--toggle"
commandFor="sms-details"
>
I want to receive SMS updates
</s-consent-checkbox>
<s-details id="sms-details">
<s-text>
By checking this box, you agree to receive text messages about your
order.
</s-text>
</s-details>
</>
);
}
import {
reactExtension,
ConsentCheckbox,
Disclosure,
Text,
View,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<Disclosure>
<ConsentCheckbox
policy="sms-marketing"
toggles="sms-details"
>
I want to receive SMS updates
</ConsentCheckbox>
<View id="sms-details">
<Text>
By checking this box, you agree to receive text messages about your
order.
</Text>
</View>
</Disclosure>
);
}
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<>
<s-consent-checkbox
policy="sms-marketing"
command="--toggle"
commandFor="sms-details"
>
I want to receive SMS updates
</s-consent-checkbox>
<s-details id="sms-details">
<s-text>
By checking this box, you agree to receive text messages about your
order.
</s-text>
</s-details>
</>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
ConsentCheckbox,
Disclosure,
Text,
View,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<Disclosure>
<ConsentCheckbox
policy="sms-marketing"
toggles="sms-details"
>
I want to receive SMS updates
</ConsentCheckbox>
<View id="sms-details">
<Text>
By checking this box, you agree to receive text messages about your
order.
</Text>
</View>
</Disclosure>
);
}Anchor to New propertiesNew properties
The Polaris consent checkbox component introduces the following new properties:
| New prop | Type | Description |
|---|---|---|
label | string | Text label for the checkbox. Use as an alternative to passing label text as children. |
value | string | Value submitted with the form. |
defaultChecked | boolean | Initial checked state for uncontrolled usage. |
Was this page helpful?