Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Commit cdc38ca

Browse files
laurkimsarahill
andauthored
[Text] Add support for bodyXs variant and fix headingLg font weight (#11094)
### WHY are these changes introduced? Updates references to font tokens in the Text component variants table. Adds support for new `bodyXs` variant. Fixes incorrect font weight for `headingLg` variant. ### WHAT is this pull request doing? Migrates font token values in Text docs from v11 to v12 at `/components/typography/text#variant-tokens`. Adds support for new `bodyXs` variant. Fixes incorrect font weight for `headingLg` variant. <details> <summary>Text variants table — before</summary> <img src="https://github.com/Shopify/polaris/assets/26749317/80980337-e7d6-4f1e-b559-8530de72a7ef" alt="Text variants table — before"> </details> <details> <summary>Text variants table — after</summary> <img src="https://github.com/Shopify/polaris/assets/26749317/76fc79b1-929e-4e35-80ef-919cbd39c0ed" alt="Text variants table — after"> </details> ### How to 🎩 🌀 [Spin](https://admin.web.text-headingxl-font-change.lo-kim.us.spin.dev/store/shop1) [Storybook](https://5d559397bae39100201eedc1-wekthcljix.chromatic.com/?path=/story/all-components-text--variants) [Prod storybook](https://storybook.polaris.shopify.com/?path=/story/all-components-text--variants) 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide --------- Co-authored-by: Sara Hill <sara.hill@shopify.com>
1 parent 01eb4b7 commit cdc38ca

File tree

6 files changed

+34
-12
lines changed

6 files changed

+34
-12
lines changed

.changeset/weak-turkeys-relate.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@shopify/polaris': minor
3+
'polaris.shopify.com': patch
4+
---
5+
6+
Added support for `bodyXs` variant and fixed font weight for `headingLg` variant in `Text` component.
7+
Updated references to font tokens from Polaris v11 to v12 in `Text` component documentation

polaris-react/src/components/Text/Text.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
.headingLg {
7676
font-size: var(--p-font-size-500);
7777
line-height: var(--p-font-line-height-600);
78-
font-weight: var(--p-font-weight-bold);
78+
font-weight: var(--p-font-weight-semibold);
7979

8080
@media (--p-breakpoints-md-up) {
8181
font-size: var(--p-text-heading-lg-font-size);
@@ -120,6 +120,12 @@
120120
@include _heading3xl;
121121
}
122122

123+
.bodyXs {
124+
font-size: var(--p-text-body-xs-font-size);
125+
font-weight: var(--p-text-body-xs-font-weight);
126+
line-height: var(--p-text-body-xs-font-line-height);
127+
}
128+
123129
.bodySm {
124130
font-size: var(--p-text-body-sm-font-size);
125131
font-weight: var(--p-text-body-sm-font-weight);

polaris-react/src/components/Text/Text.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export const Variants = () => (
3535
<Text as="p" variant="bodySm">
3636
Text with BodySm variant
3737
</Text>
38+
<Text as="p" variant="bodyXs">
39+
Text with BodyXs variant
40+
</Text>
3841
<Text as="strong" variant="bodySm">
3942
Text as a strong tag
4043
</Text>

polaris-react/src/components/Text/Text.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Variant =
2626
| 'headingXl'
2727
| 'heading2xl'
2828
| 'heading3xl'
29+
| 'bodyXs'
2930
| 'bodySm'
3031
| 'bodyMd'
3132
| 'bodyLg';

polaris.shopify.com/content/components/typography/text.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ Each variant uses a predetermined combination of the [font tokens](/tokens/font)
6868

6969
| Variant | Font size token | px value | rem value | Font line height token | Font weight token | Reponsive |
7070
| ------------ | ------------------- | -------- | --------- | ---------------------- | -------------------------- | --------- |
71-
| `heading3xl` | `--p-font-size-600` | 32 | 2 | `--p-line-height-6` | `--p-font-weight-semibold` | Yes |
72-
| `heading2xl` | `--p-font-size-500` | 28 | 1.75 | `--p-line-height-5` | `--p-font-weight-semibold` | Yes |
73-
| `headingXl` | `--p-font-size-400` | 24 | 1.5 | `--p-line-height-4` | `--p-font-weight-semibold` | Yes |
74-
| `headingLg` | `--p-font-size-300` | 20 | 1.25 | `--p-line-height-3` | `--p-font-weight-semibold` | Yes |
75-
| `headingMd` | `--p-font-size-200` | 16 | 1 | `--p-line-height-3` | `--p-font-weight-semibold` | No |
76-
| `headingSm` | `--p-font-size-100` | 14 | 0.875 | `--p-line-height-2` | `--p-font-weight-semibold` | No |
77-
| `bodyLg` | `--p-font-size-200` | 16 | 1 | `--p-line-height-2` | `--p-font-weight-regular` | No |
78-
| `bodyMd` | `--p-font-size-100` | 14 | 0.875 | `--p-line-height-2` | `--p-font-weight-regular` | No |
79-
| `bodySm` | `--p-font-size-75` | 12 | 0.75 | `--p-line-height-1` | `--p-font-weight-regular` | No |
71+
| `heading3xl` | `--p-font-size-900` | 36 | 2.25 | `--p-line-height-1200` | `--p-font-weight-bold` | Yes |
72+
| `heading2xl` | `--p-font-size-750` | 30 | 1.875 | `--p-line-height-1000` | `--p-font-weight-bold` | Yes |
73+
| `headingXl` | `--p-font-size-600` | 24 | 1.5 | `--p-line-height-800` | `--p-font-weight-bold` | Yes |
74+
| `headingLg` | `--p-font-size-500` | 20 | 1.25 | `--p-line-height-600` | `--p-font-weight-semibold` | Yes |
75+
| `headingMd` | `--p-font-size-350` | 14 | 0.875 | `--p-line-height-500` | `--p-font-weight-semibold` | No |
76+
| `headingSm` | `--p-font-size-325` | 13 | 0.8125 | `--p-line-height-500` | `--p-font-weight-semibold` | No |
77+
| `bodyLg` | `--p-font-size-350` | 14 | 0.875 | `--p-line-height-500` | `--p-font-weight-regular` | No |
78+
| `bodyMd` | `--p-font-size-325` | 13 | 0.8125 | `--p-line-height-500` | `--p-font-weight-regular` | No |
79+
| `bodySm` | `--p-font-size-300` | 12 | 0.75 | `--p-line-height-400` | `--p-font-weight-regular` | No |
80+
| `bodyXs` | `--p-font-size-275` | 11 | 0.6875 | `--p-line-height-300` | `--p-font-weight-regular` | No |
8081

8182
---
8283

polaris.shopify.com/pages/examples/text-body.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ function TextExample() {
99
Shopify POS is the easiest way to sell your products in person.
1010
Available for iPad, iPhone, and Android.
1111
</Text>
12-
<p>
12+
<Text variant="bodyMd" as="p">
1313
Shopify POS is the easiest way to sell your products in person.
1414
Available for iPad, iPhone, and Android.
15-
</p>
15+
</Text>
1616
<Text variant="bodySm" as="p">
1717
Shopify POS is the easiest way to sell your products in person.
1818
Available for iPad, iPhone, and Android.
1919
</Text>
20+
<Text variant="bodyXs" as="p">
21+
Shopify POS is the easiest way to sell your products in person.
22+
Available for iPad, iPhone, and Android.
23+
</Text>
2024
</LegacyStack>
2125
);
2226
}

0 commit comments

Comments
 (0)