--- title: Migrate to the Polaris checkbox component description: >- Learn how to migrate the Checkbox component to Polaris web components in checkout and customer account UI extensions. source_url: html: >- https://shopify.dev/docs/apps/build/checkout/migrate-to-web-components/checkbox md: >- https://shopify.dev/docs/apps/build/checkout/migrate-to-web-components/checkbox.md --- # Migrate to the Polaris checkbox component The Polaris checkbox component renders a checkbox input. It replaces the previous [`Checkbox`](https://shopify.dev/docs/api/checkout-ui-extensions/2025-07/ui-components/forms/checkbox) component and is available as [``](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox) in API versions 2025-10 and newer. *** ## Updated properties The following properties are different in the Polaris checkbox component. ### on​Change The previous `Checkbox` `onChange` prop now receives an `Event` instead of the new boolean value. Read the checked state from `event.currentTarget.checked`. ## Migrating onChange ##### Latest (Preact) ```jsx import '@shopify/ui-extensions/preact'; import {render} from 'preact'; export default function extension() { render(, document.body); } function Extension() { return ( { console.log('Checked:', event.currentTarget.checked); }} /> ); } ``` ##### Pre-Polaris (2025-07) ```jsx import { reactExtension, Checkbox, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { return ( console.log('Checked:', value)}> I agree to the terms ); } ``` ### value The previous `Checkbox` `value` prop was a `boolean` alias for `checked`, used to drive the controlled checked state. On the Polaris checkbox, use [`checked`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-checked) for controlled usage, or [`defaultChecked`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-defaultchecked) to set only the initial state for uncontrolled usage. ## Migrating value ##### Latest (Preact) ```jsx import '@shopify/ui-extensions/preact'; import {render} from 'preact'; import {useState} from 'preact/hooks'; export default function extension() { render(, document.body); } function Extension() { const [isChecked, setIsChecked] = useState(true); return ( setIsChecked(event.currentTarget.checked)} /> ); } ``` ##### Pre-Polaris (2025-07) ```jsx import { reactExtension, Checkbox, } from '@shopify/ui-extensions-react/checkout'; import {useState} from 'react'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const [isChecked, setIsChecked] = useState(true); return ( I agree to the terms ); } ``` The Polaris checkbox repurposes [`value`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-value) as a `string` used as the form submission value, and it's only submitted when the checkbox is checked. Pair it with [`name`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-name) to participate in form submission: ## Using value for form submission ```jsx ``` *** ## New properties The Polaris checkbox component introduces the following new properties: | New prop | Type | Description | | - | - | - | | [`command`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-command) | `'--auto'` \| `'--show'` \| `'--hide'` \| `'--toggle'` | Sets the action to run on the target component when the checkbox is activated. | | [`commandFor`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-commandfor) | `string` | Sets the ID of the target component for the command. | | [`defaultChecked`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-defaultchecked) | `boolean` | Sets the initial checked state for uncontrolled usage. | | [`label`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-label) | `string` | Sets the checkbox's visible label. Replaces the previous `children` pattern. For rich label content (text with inline links), use the `label` slot instead — see [children](#children) below. | | [`required`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-required) | `boolean` | Adds semantic meaning that the field needs a value. It doesn't trigger automatic validation or display an error — set the [`error`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-error) property to present an error when the checkbox is empty. | *** ## Removed properties ### children The previous `Checkbox` component accepted any element as children to render the visible label, which allowed composing the label from text, inline components, or formatting. The Polaris checkbox doesn't render children. Migrate based on the label content: * **Plain string labels** — use the [`label`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/checkbox#properties-propertydetail-label) property. * **Rich label content** (text combined with inline [``](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/actions/link)) — provide an `` element with `slot="label"`. When present, the slot takes precedence over the `label` property. The `label` slot's direct child **must be a single ``** element. Inside that ``, you can include text and inline `` elements — any other elements are stripped to keep the label safe to render inside the underlying `