Skip to main content

Text

The Text component displays text with specific visual styles and colors. Use it to present content with appropriate typography hierarchy and semantic coloring for different types of information.

Text provides a comprehensive typography system that ensures consistent styling and proper visual hierarchy across POS interfaces.

Text components ensure proper text rendering across different device types and screen sizes while maintaining readability through appropriate line heights, letter spacing, and color contrast ratios. The component automatically adjusts line length for optimal readability based on container width, preventing overly long lines that reduce reading speed and comprehension in wider layouts.

Use cases

  • Typography hierarchy: Display content with appropriate typography using variants from captions to display sizes.
  • Status information: Present status information using semantic colors to convey meaning.
  • Consistent styling: Create consistent text styling across different interface elements.
  • Visual emphasis: Provide visual emphasis through typography variants like headings and body text.

Render text content with specific visual styles and colors. This example demonstrates using Text with different variants (body, heading, caption) and semantic colors to establish proper typography hierarchy and communicate information effectively throughout your POS interface.

Show text with different styles

Show text with different styles

import React from 'react';

import { Screen, reactExtension, Text, ScrollView } from '@shopify/ui-extensions-react/point-of-sale';

const SmartGridModal = () => {
return (
<Screen name='text' title='Text'>
<ScrollView>
<Text variant="body">body</Text>
<Text variant="captionMedium">captionMedium</Text>
<Text variant="captionRegular">captionRegular</Text>
<Text variant="captionRegularTall">captionRegularTall</Text>
<Text variant="display">display</Text>
<Text variant="headingLarge">headingLarge</Text>
<Text variant="headingSmall">headingSmall</Text>
<Text variant="sectionHeader">sectionHeader</Text>
<Text variant="headingSmall" color="TextCritical">
TextCritical
</Text>
<Text variant="headingSmall" color="TextDisabled">
TextDisabled
</Text>
<Text variant="headingSmall" color="TextHighlight">
TextHighlight
</Text>
<Text variant="headingSmall" color="TextInteractive">
TextInteractive
</Text>
<Text variant="headingSmall" color="TextNeutral">
TextNeutral
</Text>
<Text variant="headingSmall" color="TextSubdued">
TextSubdued
</Text>
<Text variant="headingSmall" color="TextSuccess">
TextSuccess
</Text>
<Text variant="headingSmall" color="TextWarning">
TextWarning
</Text>
</ScrollView>
</Screen>
);
}

export default reactExtension('pos.home.modal.render', () => {
return <SmartGridModal />
})

Configure the following properties on the Text component.

The semantic color of the text that conveys meaning and intent through visual styling.

The typography variant that determines the size, weight, and styling of the text within the design system hierarchy.

  • Apply semantic colors to convey meaning: Use color to communicate the nature and intent of your content. Apply TextSuccess for positive outcomes, TextCritical for errors, TextWarning for cautions, and TextInteractive for clickable elements.
  • Maintain consistent typography patterns: Establish consistent patterns for how you use text variants across your POS UI extension. Similar types of content should use similar variants, helping users develop familiarity with your interface hierarchy.
  • Use subdued colors strategically: Apply TextSubdued for secondary information that supports but doesn't compete with primary content. Use TextDisabled only for truly inactive content that users can't interact with.
  • Balance emphasis with clarity: Use highlighting and interactive colors sparingly to maintain their effectiveness. Too many emphasized elements can reduce the impact of truly important content.

  • Text content is provided through child components rather than direct text properties—organize your text content through component composition.
  • Typography and color options are limited to the predefined design system variants—custom fonts, sizes, or colors beyond the available options aren't supported.
  • Complex rich text formatting requires multiple Text components with different variants and colors rather than inline formatting options.
Was this page helpful?