Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

Text

Text is used to visually style and provide semantic value for a small piece of text content.

Support
Targets (50)

Supported targets


Anchor to accessibilityRole
accessibilityRole

Sets the semantic meaning of the text content for assistive technologies. When set, the role conveys additional context about the text's purpose.

  • address: Indicates the text is contact information. Typically used for addresses.
  • deletion: Indicates the text has been deleted. Typically used for discounted prices.
  • marking: Indicates the text is marked or highlighted and relevant to the user's current action.
  • stress: Indicates emphatic stress. Typically for words that have a stressed emphasis compared to surrounding text.
  • offset: Indicates an offset from the normal prose of the text. Typically used for a foreign word or fictional character thoughts.
  • strong: Indicates strong importance, seriousness, or urgency.
Anchor to accessibilityVisibility
accessibilityVisibility

Controls the visibility of the element to assistive technologies. Set to 'hidden' to hide the element from assistive technologies while keeping it visually visible.

Anchor to appearance
appearance
'subdued' | 'accent' | 'decorative' | 'info' | 'success' | 'warning' | 'critical'

Changes the visual appearance of the text, letting you convey meaning through color.

  • accent: Conveys emphasis and draws attention to the element.
  • subdued: Conveys a subdued or disabled state.
  • info: Conveys informational content.
  • success: Conveys a successful interaction.
  • warning: Conveys something needs attention or action.
  • critical: Conveys a problem has arisen.
  • decorative: Uses the decorative color set within the theme.
Anchor to emphasis
emphasis

Use to emphasize a word or a group of words. Set to bold or italic to apply typographic emphasis that communicates visual hierarchy or stress.

  • italic: Sets the text in italic. Combine with an accessibilityRole of offset or stress to add more meaning to the text.
  • bold: Sets the text in bold. Combine with an accessibilityRole of strong to add more meaning to the text.
string

A unique identifier for the component. Typically used as a target for another component's controls to associate an accessible label with an action.

A keyword that sets the size of the text. Sizes map to the design system's type scale.

  • extraSmall: The smallest text size.
  • small: A smaller text size for secondary content.
  • base: The default text size for body content.
  • medium: A slightly larger text size.
  • large: A larger text size for emphasis.
  • extraLarge: The largest text size.
Anchor to visibility
visibility

Controls the visual visibility of the element. Set to 'hidden' to visually hide the element while keeping it accessible to assistive technologies.


Basic Text

Example

Basic Text

import {
reactExtension,
Text,
BlockStack,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
<BlockStack inlineAlignment="center">
<Text size="extraSmall">Total</Text>
<Text size="small">Total</Text>
<Text size="base">Total</Text>
<Text size="medium">Total</Text>
<Text size="large">Total</Text>
<Text size="extraLarge">Total</Text>
</BlockStack>
);
}
import {extension, Text, BlockStack} from '@shopify/ui-extensions/checkout';

export default extension('purchase.checkout.block.render', (root) => {
const text = root.createComponent(BlockStack, undefined, [
root.createComponent(Text, {size: 'extraSmall'}, 'Total'),
root.createComponent(Text, {size: 'small'}, 'Total'),
root.createComponent(Text, {size: 'base'}, 'Total'),
root.createComponent(Text, {size: 'medium'}, 'Total'),
root.createComponent(Text, {size: 'large'}, 'Total'),
root.createComponent(Text, {size: 'extraLarge'}, 'Total'),
]);

root.appendChild(text);
});

ValueDescription
"accent"Conveys emphasis and draws attention to the element.
"subdued"Conveys a subdued or disabled state for the element.
"info"Conveys that the element is informative or has information.
"success"Convey a successful interaction.
"warning"Convey something needs attention or an action needs to be taken.
"critical"Conveys a problem has arisen.

  • Use larger text to emphasize content that’s not a heading, such as a price total.

  • Create contrast between more and less important text with properties such as size and subdued.



Was this page helpful?