# Badge 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. ```tsx import { reactExtension, Badge, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { return Available; } ``` ```js 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); }); ``` ## BadgeProps ### BadgeProps ### accessibilityLabel value: `string` 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. ### accessibilityVisibility value: `AccessibilityVisibility` - AccessibilityVisibility: 'hidden' - Visibility: 'hidden' 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. ### icon value: `IconSource` - IconSource: 'arrowLeft' | 'arrowRight' | 'arrowUp' | 'arrowUpRight' | 'arrowDown' | 'bag' | 'calendar' | 'camera' | 'caretDown' | 'cart' | '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' | 'star' | 'starFill' | 'starHalf' | 'store' | 'success' | 'truck' | 'verticalDots' | 'warning' | 'warningFill' The name of the icon to be displayed in the badge. ### iconPosition value: `'start' | 'end'` The position of the icon in relation to the text. ### size value: `Extract` - Size: 'extraSmall' | 'small' | 'base' | 'large' | 'extraLarge' | 'fill' The size of the badge being rendered. ### tone value: `Tone` - Tone: 'default' | 'critical' | 'subdued' 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. ### visibility value: `Visibility` - Visibility: 'hidden' 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; ## Examples 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. ```tsx import { reactExtension, Badge, BlockStack, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { return ( Subscription Mini garden seeds $35.00 monthly Paused ); } ``` ```js 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); }); ``` ## Examples 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. ```tsx import { reactExtension, Badge, BlockStack, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { return ( Subscription Mini garden seeds $35.00 monthly Paused ); } ``` ```js 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); }); ```