Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(templates): reorder TextTypes to Body, Large, Label, Supporting, Code (#1658)

Kenton Quatman71b3e36a06b4
diff --git a/packages/cli/templates/blocks/components/Text/TextCard.doc.mjs b/packages/cli/templates/blocks/components/Text/TextCard.doc.mjs
deleted file mode 100644
index 66a92005ea..0000000000
--- a/packages/cli/templates/blocks/components/Text/TextCard.doc.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
-export const doc = {
- type: 'block',
- name: 'Text — Card',
- description: 'Card layout with a label title, truncated body, and a supporting timestamp showing text hierarchy in a contained space.',
- isReady: true,
- aspectRatio: 16 / 9,
- componentsUsed: ['Text', 'Card', 'Stack'],
-};
diff --git a/packages/cli/templates/blocks/components/Text/TextCard.tsx b/packages/cli/templates/blocks/components/Text/TextCard.tsx
deleted file mode 100644
index 6240dbeafd..0000000000
--- a/packages/cli/templates/blocks/components/Text/TextCard.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-'use client';
-
-import {XDSText, XDSHeading} from '@xds/core/Text';
-import {XDSCard} from '@xds/core/Card';
-import {XDSStack} from '@xds/core/Stack';
-
-export default function TextCard() {
- return (
- <XDSCard padding={4}>
- <XDSStack direction="vertical" gap={1}>
- <XDSHeading level={4}>Quarterly design review</XDSHeading>
- <XDSText type="body" maxLines={2} display="block">
- Review the latest component audit results, discuss the new color token
- strategy, and align on the typography scale changes planned for Q2.
- </XDSText>
- <XDSText type="supporting" display="block">
- Updated 5 minutes ago by Sarah Chen
- </XDSText>
- </XDSStack>
- </XDSCard>
- );
-}
diff --git a/packages/cli/templates/blocks/components/Text/TextHierarchy.doc.mjs b/packages/cli/templates/blocks/components/Text/TextHierarchy.doc.mjs
deleted file mode 100644
index 40cb5f2965..0000000000
--- a/packages/cli/templates/blocks/components/Text/TextHierarchy.doc.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
-export const doc = {
- type: 'block',
- name: 'Text — Hierarchy',
- description: 'Label, body, and supporting text types layered to create a natural reading order without any custom styling.',
- isReady: true,
- aspectRatio: 16 / 9,
- componentsUsed: ['Text', 'Stack'],
-};
diff --git a/packages/cli/templates/blocks/components/Text/TextHierarchy.tsx b/packages/cli/templates/blocks/components/Text/TextHierarchy.tsx
deleted file mode 100644
index 883ec759ad..0000000000
--- a/packages/cli/templates/blocks/components/Text/TextHierarchy.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-'use client';
-
-import {XDSText} from '@xds/core/Text';
-import {XDSStack} from '@xds/core/Stack';
-
-export default function TextHierarchy() {
- return (
- <XDSStack direction="vertical" gap={4}>
- <XDSStack direction="vertical" gap={1}>
- <XDSText type="label" display="block">
- Account settings
- </XDSText>
- <XDSText type="body" display="block">
- Manage your profile information, notification preferences, and security
- options from this page.
- </XDSText>
- <XDSText type="supporting" display="block">
- Last updated 3 hours ago
- </XDSText>
- </XDSStack>
- <XDSStack direction="vertical" gap={1}>
- <XDSText type="label" display="block">
- Billing details
- </XDSText>
- <XDSText type="body" display="block">
- Your next invoice of $49.00 is scheduled for January 15, 2025. All
- charges are billed in USD.
- </XDSText>
- <XDSText type="supporting" color="active" display="block">
- Payment method verified
- </XDSText>
- </XDSStack>
- </XDSStack>
- );
-}
diff --git a/packages/cli/templates/blocks/components/Text/TextInline.doc.mjs b/packages/cli/templates/blocks/components/Text/TextInline.doc.mjs
new file mode 100644
index 0000000000..aed6825afa
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextInline.doc.mjs
@@ -0,0 +1,9 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'Text — Inline',
+ description: 'Mixing body and code text inline within a single line using the default inline display mode.',
+ isReady: true,
+ aspectRatio: 16 / 9,
+ componentsUsed: ['Text'],
+};
diff --git a/packages/cli/templates/blocks/components/Text/TextInline.tsx b/packages/cli/templates/blocks/components/Text/TextInline.tsx
new file mode 100644
index 0000000000..7d2225e471
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextInline.tsx
@@ -0,0 +1,13 @@
+'use client';
+
+import {XDSText} from '@xds/core/Text';
+
+export default function TextInline() {
+ return (
+ <XDSText type="body" display="block">
+ Design tokens are{' '}
+ <XDSText type="code">themeable</XDSText>
+ {' '}and shared across every surface.
+ </XDSText>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/Text/TextMetrics.tsx b/packages/cli/templates/blocks/components/Text/TextMetrics.tsx
deleted file mode 100644
index 597e175081..0000000000
--- a/packages/cli/templates/blocks/components/Text/TextMetrics.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-'use client';
-
-import {XDSText} from '@xds/core/Text';
-import {XDSStack} from '@xds/core/Stack';
-
-const METRICS = [
- {label: 'Revenue', value: '$1,234,567.89'},
- {label: 'Active users', value: '12,345'},
- {label: 'Conversion', value: '23.4%', color: 'active' as const},
-];
-
-export default function TextMetrics() {
- return (
- <XDSStack direction="horizontal" gap={6}>
- {METRICS.map(({label, value, color}) => (
- <XDSStack key={label} direction="vertical" gap={0}>
- <XDSText type="supporting" color="secondary" display="block">
- {label}
- </XDSText>
- <XDSText
- type="large"
- weight="bold"
- color={color}
- hasTabularNumbers
- >
- {value}
- </XDSText>
- </XDSStack>
- ))}
- </XDSStack>
- );
-}
diff --git a/packages/cli/templates/blocks/components/Text/TextTruncation.doc.mjs b/packages/cli/templates/blocks/components/Text/TextTruncation.doc.mjs
index 90b749e8cb..ddc4e67e03 100644
--- a/packages/cli/templates/blocks/components/Text/TextTruncation.doc.mjs
+++ b/packages/cli/templates/blocks/components/Text/TextTruncation.doc.mjs
@@ -2,8 +2,8 @@
export const doc = {
type: 'block',
name: 'Text — Truncation',
- description: 'Text truncation at 1, 2, and 3 lines with automatic ellipsis and hover tooltips that reveal the full content.',
+ description: 'Single-line and multi-line text truncation with ellipsis using maxLines in a width-constrained container.',
isReady: true,
- aspectRatio: 16 / 9,
- componentsUsed: ['Text', 'Stack', 'Section'],
+ aspectRatio: 4 / 3,
+ componentsUsed: ['Text'],
};
diff --git a/packages/cli/templates/blocks/components/Text/TextTruncation.tsx b/packages/cli/templates/blocks/components/Text/TextTruncation.tsx
index 5411b288b9..d874b0f9dd 100644
--- a/packages/cli/templates/blocks/components/Text/TextTruncation.tsx
+++ b/packages/cli/templates/blocks/components/Text/TextTruncation.tsx
@@ -1,11 +1,9 @@
'use client';
import {XDSText} from '@xds/core/Text';
-import {XDSStack} from '@xds/core/Stack';
-import {XDSSection} from '@xds/core/Section';
const LONG_TEXT =
- 'The design system provides a consistent set of typography tokens, spacing scales, and color palettes that ensure every surface in the product feels cohesive regardless of which team built it. Components inherit these tokens automatically so teams can build new features without manually matching fonts, colors, or spacing values across different surfaces and breakpoints.';
+ 'The design system provides a consistent set of typography tokens, spacing scales, and color palettes that ensure every surface in the product feels cohesive regardless of which team built it.';
const LINES = [
{maxLines: 1, label: '1 line'},
@@ -15,19 +13,25 @@ const LINES = [
export default function TextTruncation() {
return (
- <XDSStack direction="vertical" gap={3}>
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 16,
+ maxWidth: 300,
+ }}>
{LINES.map(({maxLines, label}) => (
- <XDSStack key={maxLines} direction="vertical" gap={1}>
- <XDSText type="supporting" color="secondary">
+ <div key={maxLines}>
+ <XDSText type="supporting" color="secondary" display="block">
{label}
</XDSText>
- <XDSSection padding={2} variant="wash">
+ <div style={{border: '1px solid #ccc', padding: 8}}>
<XDSText type="body" maxLines={maxLines}>
{LONG_TEXT}
</XDSText>
- </XDSSection>
- </XDSStack>
+ </div>
+ </div>
))}
- </XDSStack>
+ </div>
);
}
diff --git a/packages/cli/templates/blocks/components/Text/TextTypes.doc.mjs b/packages/cli/templates/blocks/components/Text/TextTypes.doc.mjs
index 6bbefcb71b..af61d809d3 100644
--- a/packages/cli/templates/blocks/components/Text/TextTypes.doc.mjs
+++ b/packages/cli/templates/blocks/components/Text/TextTypes.doc.mjs
@@ -4,6 +4,6 @@ export const doc = {
name: 'Text — Types',
description: 'All 5 semantic text types (body, large, label, supporting, code) with their default styling from the theme.',
isReady: true,
- aspectRatio: 16 / 9,
+ aspectRatio: 4 / 3,
componentsUsed: ['Text', 'Stack'],
};
diff --git a/packages/cli/templates/blocks/components/Text/TextTypes.tsx b/packages/cli/templates/blocks/components/Text/TextTypes.tsx
index 76a0506ac0..f4c038f84f 100644
--- a/packages/cli/templates/blocks/components/Text/TextTypes.tsx
+++ b/packages/cli/templates/blocks/components/Text/TextTypes.tsx
@@ -4,22 +4,28 @@ import {XDSText} from '@xds/core/Text';
import {XDSStack} from '@xds/core/Stack';
const TYPES = [
- {type: 'large' as const, label: 'Large text', sample: 'Large text for introductions and callouts'},
{type: 'body' as const, label: 'Body text', sample: 'Body text for paragraphs and general content'},
+ {type: 'large' as const, label: 'Large text', sample: 'Large text for introductions and callouts'},
{type: 'label' as const, label: 'Label text', sample: 'Label text for form fields and section titles'},
{type: 'supporting' as const, label: 'Supporting text', sample: 'Supporting text for captions and metadata'},
{type: 'code' as const, label: 'Code text', sample: 'const theme = defineTheme({})'},
+ {type: 'body' as const, label: 'Strikethrough', sample: 'Body text with strikethrough decoration', hasStrikethrough: true},
+ {type: 'body' as const, label: 'Tabular numbers', sample: '1,234.56 78.90 100,000.00', hasTabularNumbers: true},
];
export default function TextTypes() {
return (
<XDSStack direction="vertical" gap={3}>
- {TYPES.map(({type, label, sample}) => (
- <XDSStack key={type} direction="vertical" gap={0}>
+ {TYPES.map(({type, label, sample, hasStrikethrough, hasTabularNumbers}) => (
+ <XDSStack key={label} direction="vertical" gap={0}>
<XDSText type="supporting" color="secondary">
{label}
</XDSText>
- <XDSText type={type} display="block">
+ <XDSText
+ type={type}
+ display="block"
+ hasStrikethrough={hasStrikethrough}
+ hasTabularNumbers={hasTabularNumbers}>
{sample}
</XDSText>
</XDSStack>
diff --git a/packages/cli/templates/blocks/components/Text/TextMetrics.doc.mjs b/packages/cli/templates/blocks/components/Text/TextWeight.doc.mjs
similarity index 57%
rename from packages/cli/templates/blocks/components/Text/TextMetrics.doc.mjs
rename to packages/cli/templates/blocks/components/Text/TextWeight.doc.mjs
index 0bea4206d2..612233e329 100644
--- a/packages/cli/templates/blocks/components/Text/TextMetrics.doc.mjs
+++ b/packages/cli/templates/blocks/components/Text/TextWeight.doc.mjs
@@ -1,8 +1,8 @@
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
export const doc = {
type: 'block',
- name: 'Text — Metrics',
- description: 'Dashboard-style metrics using tabular numbers for consistent digit alignment across values.',
+ name: 'Text — Weight',
+ description: 'The 4 font weight variants (normal, medium, semibold, bold) applied to body text.',
isReady: true,
aspectRatio: 16 / 9,
componentsUsed: ['Text', 'Stack'],
diff --git a/packages/cli/templates/blocks/components/Text/TextWeight.tsx b/packages/cli/templates/blocks/components/Text/TextWeight.tsx
new file mode 100644
index 0000000000..e715934066
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextWeight.tsx
@@ -0,0 +1,23 @@
+'use client';
+
+import {XDSText} from '@xds/core/Text';
+import {XDSStack} from '@xds/core/Stack';
+
+const WEIGHTS = [
+ {weight: 'normal' as const, label: 'Normal'},
+ {weight: 'medium' as const, label: 'Medium'},
+ {weight: 'semibold' as const, label: 'Semibold'},
+ {weight: 'bold' as const, label: 'Bold'},
+];
+
+export default function TextWeight() {
+ return (
+ <XDSStack direction="vertical" gap={3}>
+ {WEIGHTS.map(({weight, label}) => (
+ <XDSText key={weight} type="body" weight={weight} display="block">
+ {label}
+ </XDSText>
+ ))}
+ </XDSStack>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/Text/TextWordBreak.doc.mjs b/packages/cli/templates/blocks/components/Text/TextWordBreak.doc.mjs
new file mode 100644
index 0000000000..3e65ce0965
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextWordBreak.doc.mjs
@@ -0,0 +1,9 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'Text — Word Break',
+ description: 'Compares break-word and break-all word break modes on a long unbreakable string.',
+ isReady: true,
+ aspectRatio: 16 / 9,
+ componentsUsed: ['Text'],
+};
diff --git a/packages/cli/templates/blocks/components/Text/TextWordBreak.tsx b/packages/cli/templates/blocks/components/Text/TextWordBreak.tsx
new file mode 100644
index 0000000000..1c440efe2e
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextWordBreak.tsx
@@ -0,0 +1,36 @@
+'use client';
+
+import {XDSText} from '@xds/core/Text';
+
+export default function TextWordBreak() {
+ return (
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 16,
+ maxWidth: 400,
+ }}>
+ <div>
+ <XDSText type="label" display="block">
+ Break-word (default for multi-line)
+ </XDSText>
+ <div style={{width: 200, border: '1px solid #ccc', padding: 8}}>
+ <XDSText type="body" maxLines={2} wordBreak="break-word">
+ This is a verylongunbreakableword for a break-word example
+ </XDSText>
+ </div>
+ </div>
+ <div>
+ <XDSText type="label" display="block">
+ Break-all (default for single-line)
+ </XDSText>
+ <div style={{width: 200, border: '1px solid #ccc', padding: 8}}>
+ <XDSText type="body" maxLines={2} wordBreak="break-all">
+ Breaks anywhere: abcdefghijklmnopqrstuvwxyz0123456789
+ </XDSText>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/Text/TextWrap.doc.mjs b/packages/cli/templates/blocks/components/Text/TextWrap.doc.mjs
new file mode 100644
index 0000000000..8aae44e6ff
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextWrap.doc.mjs
@@ -0,0 +1,9 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'Text — Wrap',
+ description: 'The 4 text-wrap modes (wrap, nowrap, balance, pretty) shown in width-constrained containers.',
+ isReady: true,
+ aspectRatio: 1 / 1,
+ componentsUsed: ['Text'],
+};
diff --git a/packages/cli/templates/blocks/components/Text/TextWrap.tsx b/packages/cli/templates/blocks/components/Text/TextWrap.tsx
new file mode 100644
index 0000000000..04a9fc180f
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Text/TextWrap.tsx
@@ -0,0 +1,64 @@
+'use client';
+
+import {XDSText} from '@xds/core/Text';
+
+export default function TextWrap() {
+ return (
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 16,
+ maxWidth: 400,
+ }}>
+ <div>
+ <XDSText type="label" display="block">
+ Wrap (default)
+ </XDSText>
+ <div style={{border: '1px solid #ccc', padding: 8, width: 200}}>
+ <XDSText type="body" textWrap="wrap">
+ This text wraps normally at word boundaries when it reaches the
+ edge.
+ </XDSText>
+ </div>
+ </div>
+ <div>
+ <XDSText type="label" display="block">
+ Nowrap
+ </XDSText>
+ <div
+ style={{
+ border: '1px solid #ccc',
+ padding: 8,
+ width: 200,
+ overflow: 'hidden',
+ }}>
+ <XDSText type="body" textWrap="nowrap">
+ This text does not wrap and will overflow its container.
+ </XDSText>
+ </div>
+ </div>
+ <div>
+ <XDSText type="label" display="block">
+ Balance
+ </XDSText>
+ <div style={{border: '1px solid #ccc', padding: 8, width: 200}}>
+ <XDSText type="body" textWrap="balance">
+ This text is balanced for better visual appearance across lines.
+ </XDSText>
+ </div>
+ </div>
+ <div>
+ <XDSText type="label" display="block">
+ Pretty
+ </XDSText>
+ <div style={{border: '1px solid #ccc', padding: 8, width: 200}}>
+ <XDSText type="body" textWrap="pretty">
+ This text uses pretty wrap to avoid orphans at the end of
+ paragraphs.
+ </XDSText>
+ </div>
+ </div>
+ </div>
+ );
+}