Options inside a [ToggleButtonGroup](/docs/api/checkout-ui-extensions/components/forms/togglebuttongroup).
import {
reactExtension,
ToggleButton,
ToggleButtonGroup,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<ToggleButtonGroup
value="none"
onChange={(value) => {
console.log(
`onChange event with value: ${value}`,
);
}}
>
<ToggleButton id="none">None</ToggleButton>
</ToggleButtonGroup>
);
}
import {
extension,
ToggleButtonGroup,
ToggleButton,
} from '@shopify/ui-extensions/checkout';
export default extension('purchase.checkout.block.render', (root) => {
const toggleButtonGroup = root.createComponent(
ToggleButtonGroup,
{
value: 'none',
onChange: (value) => {
console.log(`onChange event with value: ${value}`);
},
},
[root.createComponent(ToggleButton, {id: 'none'}, 'None')],
);
root.appendChild(toggleButtonGroup);
});
A label used for buyers using assistive technologies. When set, any `children` supplied to this component will not be announced to screen reader users.
Disables the button, disallowing any interaction.
A unique identifier for the toggle button.
Callback when button is pressed.