Use badges to highlight contextual information, like a label or a status, about an object. An object can be anything that has a status or label attributed to it, like an order or subscription.
import {
reactExtension,
Badge,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return <Badge>Available</Badge>;
}
import {extension, Badge} from '@shopify/ui-extensions/checkout';
export default extension('purchase.checkout.block.render', (root) => {
const badge = root.createComponent(Badge, undefined, 'Available');
root.appendChild(badge);
});
A label that describes the purpose or contents of the element. When set, it will be passed as `aria-label` to underlying element and announced to buyers using assistive technologies.
Changes the visibility of the element to assistive technologies. `hidden` hides the component from assistive technology (for example, a screen reader) but remains visually visible.
The name of the icon to be displayed in the badge.
The position of the icon in relation to the text.
The size of the badge being rendered.
The tone of the badge being rendered. Indicates its level of importance, where subdued provides the least emphasis, while critical indicates the highest level of urgency.
Changes the visibility of the element. `hidden` visually hides the component while keeping it accessible to assistive technology, such as screen readers. Hidden elements don't take any visual space contrary to CSS visibility: hidden;
'hidden'
'arrowLeft' | 'arrowRight' | 'arrowUp' | 'arrowUpRight' | 'arrowDown' | 'bag' | 'bullet' | 'calendar' | 'camera' | 'caretDown' | 'cart' | 'categories' | 'checkmark' | 'chevronLeft' | 'chevronRight' | 'chevronUp' | 'chevronDown' | 'clock' | 'close' | 'critical' | 'delete' | 'delivered' | 'delivery' | 'disabled' | 'discount' | 'email' | 'error' | 'errorFill' | 'external' | 'filter' | 'geolocation' | 'gift' | 'giftFill' | 'grid' | 'hamburger' | 'hollowCircle' | 'horizontalDots' | 'image' | 'info' | 'infoFill' | 'list' | 'lock' | 'magnify' | 'map' | 'marker' | 'minus' | 'mobile' | 'note' | 'orderBox' | 'pen' | 'plus' | 'profile' | 'question' | 'questionFill' | 'reorder' | 'return' | 'savings' | 'settings' | 'star' | 'starFill' | 'starHalf' | 'store' | 'success' | 'truck' | 'verticalDots' | 'warning' | 'warningFill'
'extraSmall' | 'small' | 'base' | 'large' | 'extraLarge' | 'fill'
'default' | 'critical' | 'subdued'
'hidden'
Use badges to highlight contextual information, like a label or a status, about an object. An object can be anything that has a status or label attributed to it, like an order or subscription.
import {
reactExtension,
Badge,
BlockStack,
Text,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<BlockStack
border="base"
padding="large200"
spacing="base"
borderRadius="large"
>
<BlockStack spacing="none">
<Text size="large" emphasis="bold">
Subscription
</Text>
<Text>Mini garden seeds</Text>
</BlockStack>
<BlockStack
spacing="none"
inlineAlignment="start"
>
<Text emphasis="bold">
$35.00 monthly
</Text>
<Badge tone="subdued">Paused</Badge>
</BlockStack>
</BlockStack>
);
}
import {
extension,
Badge,
BlockStack,
Text,
} from '@shopify/ui-extensions/checkout';
export default extension('purchase.checkout.block.render', (root) => {
const container = root.createComponent(
BlockStack,
{
border: 'base',
padding: 'large200',
spacing: 'base',
borderRadius: 'large',
},
[
root.createComponent(BlockStack, {spacing: 'none'}, [
root.createComponent(
Text,
{size: 'large', emphasis: 'bold'},
'Subscription',
),
root.createComponent(Text, undefined, 'Mini garden seeds'),
]),
root.createComponent(
BlockStack,
{spacing: 'none', inlineAlignment: 'start'},
[
root.createComponent(Text, {emphasis: 'bold'}, '$35.00 monthly'),
root.createComponent(Badge, {tone: 'subdued'}, 'Paused'),
],
),
],
);
root.appendChild(container);
});
import {
reactExtension,
Badge,
BlockStack,
Text,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<BlockStack
border="base"
padding="large200"
spacing="base"
borderRadius="large"
>
<BlockStack spacing="none">
<Text size="large" emphasis="bold">
Subscription
</Text>
<Text>Mini garden seeds</Text>
</BlockStack>
<BlockStack
spacing="none"
inlineAlignment="start"
>
<Text emphasis="bold">
$35.00 monthly
</Text>
<Badge tone="subdued">Paused</Badge>
</BlockStack>
</BlockStack>
);
}
import {
extension,
Badge,
BlockStack,
Text,
} from '@shopify/ui-extensions/checkout';
export default extension('purchase.checkout.block.render', (root) => {
const container = root.createComponent(
BlockStack,
{
border: 'base',
padding: 'large200',
spacing: 'base',
borderRadius: 'large',
},
[
root.createComponent(BlockStack, {spacing: 'none'}, [
root.createComponent(
Text,
{size: 'large', emphasis: 'bold'},
'Subscription',
),
root.createComponent(Text, undefined, 'Mini garden seeds'),
]),
root.createComponent(
BlockStack,
{spacing: 'none', inlineAlignment: 'start'},
[
root.createComponent(Text, {emphasis: 'bold'}, '$35.00 monthly'),
root.createComponent(Badge, {tone: 'subdued'}, 'Paused'),
],
),
],
);
root.appendChild(container);
});