# Typography Guidelines ## Contents - [Core Typography Pattern](#core-typography-pattern) - [Typography Rules](#typography-rules) - [Complete Examples](#complete-examples) - [Text Color Classes](#text-color-classes) - [Common Patterns](#common-patterns) - [Quick Reference](#quick-reference) ## Core Typography Pattern Use the `Text` component from `@medusajs/ui` for all text elements. Follow these specific patterns: ### Headings/Labels Use this pattern for section headings, field labels, or any primary text: ```tsx {labelText} ``` ### Body/Descriptions Use this pattern for descriptions, helper text, or secondary information: ```tsx {descriptionText} ``` ## Typography Rules - **Never use** `` component for small sections within widgets/containers - **Always use** `size="small"` and `leading="compact"` for consistency - **Use** `weight="plus"` for labels and headings - **Use** `className="text-ui-fg-subtle"` for secondary/descriptive text - **For larger headings** (page titles, container headers), use the `` component ## Complete Examples ### Widget Section with Label and Description ```tsx import { Text } from "@medusajs/ui" // In a container or widget:
Product Settings Configure how this product appears in your store
``` ### List Item with Title and Subtitle ```tsx
Premium T-Shirt Size: Large • Color: Blue
``` ### Container Header (Use Heading) ```tsx import { Container, Heading } from "@medusajs/ui"
Related Products
{/* ... */}
``` ### Empty State Message ```tsx No related products selected ``` ### Form Field Label ```tsx
Display Name
``` ### Error Message ```tsx This field is required ``` ### Badge or Status Text ```tsx
Status: Active
``` ## Text Color Classes Medusa UI provides semantic color classes: - `text-ui-fg-base` - Default text color (rarely needed, it's the default) - `text-ui-fg-subtle` - Secondary/muted text - `text-ui-fg-muted` - Even more muted - `text-ui-fg-disabled` - Disabled state - `text-ui-fg-error` - Error messages - `text-ui-fg-success` - Success messages - `text-ui-fg-warning` - Warning messages ## Common Patterns ### Two-Column Layout ```tsx
Category Clothing
Status Published
``` ### Inline Label-Value Pair ```tsx
SKU: SHIRT-001
``` ### Card with Title and Metadata ```tsx
Premium Cotton T-Shirt
$29.99 In stock
``` ## Quick Reference | Use Case | Pattern | |----------|---------| | Section headings | `weight="plus"` | | Primary text | `weight="plus"` | | Labels | `weight="plus"` | | Descriptions | `className="text-ui-fg-subtle"` | | Helper text | `className="text-ui-fg-subtle"` | | Metadata | `className="text-ui-fg-subtle"` | | Errors | `className="text-ui-fg-error"` | | Empty states | `className="text-ui-fg-subtle"` | | Large headers | `` component |