Learn about customisation options for the pre-fill billing address checkbox.
const prefillBillingAddressCheckboxConfig: PrefillBillingAddressCheckboxComponentConfig = {
label: string,
labelStyles: {
checked: {
color: string,
fontWeight: string,
fontSize: string
},
unchecked: {
color: string,
fontSize: string
}
},
checked: boolean,
checkedColor: string,
tabIndex: number,
countrySelectionComponent: CountrySelectionComponent,
postcodeComponent: PostcodeComponent,
addressComponent: AddressComponent
};| Property | Description |
|---|---|
labelstring | The text label to display next to the pre-fill billing address checkbox. |
labelStylesobject | Custom styles for the pre-fill billing address checkbox's label. |
labelStyles.checkedCssProperties | Details about the styles to apply the checkbox is checked. |
labelStyles.checked.colorstring | The HEX colour code of the text. |
labelStyles.checked.fontWeightstring | The weight of the font. |
labelStyles.checked.fontSizestring | The size of the font. |
labelStyles.uncheckedCssProperties | Details about the styles to apply when the checkbox is unchecked. |
labelStyles.unchecked.colorstring | The HEX colour code of the text. |
labelStyles.unchecked.fontSizestring | The size of the font. |
checkedboolean | The initial state of the checkbox. |
checkedColorstring | The HEX colour code of the checkbox, when checked. |
tabIndexnumber | The tab index of the component. |
countrySelectionComponentCountrySelectionComponent | Configuration for the country selection component. See Country selection. |
postcodeComponentPostcodeComponent | Configuration for the postcode component. See Postcode. |
addressComponentAddressComponent | Configuration for the address component. See Address. |
const prefillBillingAddressCheckboxConfig: PrefillBillingAddressCheckboxComponentConfig = {
label: "Use shipping address for billing",
checked: false,
checkedColor: "#007bff",
tabIndex: 5,
labelStyles: {
checked: {
color: "#007bff",
fontWeight: "500"
},
unchecked: {
color: "#666666",
fontWeight: "normal"
}
},
countrySelectionComponent: countryComponent,
postcodeComponent: postcodeComponent,
addressComponent: addressComponent,
onChange: (event) => {
console.log("Prefill checkbox changed:", event.target.checked);
},
onFocus: (event) => {
console.log("Prefill checkbox focused");
},
onBlur: (event) => {
console.log("Prefill checkbox blurred");
},
onValidationPassed: (data) => {
console.log("Prefill checkbox validation passed");
},
onValidationFailed: (data) => {
console.log("Prefill checkbox validation failed:", data);
}
};