Skip to content

Commit a0e52a3

Browse files
authored
[Text] Add in table to map variants to font tokens (#8593)
### WHY are these changes introduced? Adds in table to show what tokens each `Text` variant maps to for clarity. ### WHAT is this pull request doing? New table: <details> <summary>Text variant chart</summary> <img src="https://user-images.githubusercontent.com/26749317/223731990-be8ef776-8e4a-4af1-8f17-04ff6ad3395d.png" alt="Text variant chart"> </details> <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 🖥 [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) - [ ] 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
1 parent cb41f71 commit a0e52a3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

.changeset/popular-geckos-tease.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': patch
3+
---
4+
5+
Added in chart to map `Text` variants to font tokens

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ examples:
4545
Use to set text color.
4646
---
4747

48+
## Variant tokens
49+
50+
Each variant uses a predetermined combination of the [font tokens](/tokens/font) to set the font size and line height. Heading variants have a set font weight but can be overridden by using the `fontWeight` prop.
51+
52+
| Variant | Font size token | px value | rem value | Font line height token | Font weight token | Reponsive |
53+
| ------------ | ------------------- | -------- | --------- | ---------------------- | -------------------------- | --------- |
54+
| `heading4Xl` | `--p-font-size-700` | 40 | 2.5 | `--p-line-height-7` | `--p-font-weight-bold` | Yes |
55+
| `heading3Xl` | `--p-font-size-600` | 32 | 2 | `--p-line-height-6` | `--p-font-weight-semibold` | Yes |
56+
| `heading2Xl` | `--p-font-size-500` | 28 | 1.75 | `--p-line-height-5` | `--p-font-weight-semibold` | Yes |
57+
| `headingXl` | `--p-font-size-400` | 24 | 1.5 | `--p-line-height-4` | `--p-font-weight-semibold` | Yes |
58+
| `headingLg` | `--p-font-size-300` | 20 | 1.25 | `--p-line-height-3` | `--p-font-weight-semibold` | Yes |
59+
| `headingMd` | `--p-font-size-200` | 16 | 1 | `--p-line-height-3` | `--p-font-weight-semibold` | No |
60+
| `headingSm` | `--p-font-size-100` | 14 | 0.875 | `--p-line-height-2` | `--p-font-weight-semibold` | No |
61+
| `headingXs` | `--p-font-size-75` | 12 | 0.75 | `--p-line-height-1` | `--p-font-weight-semibold` | No |
62+
| `bodyLg` | `--p-font-size-200` | 16 | 1 | `--p-line-height-2` | `--p-font-weight-regular` | No |
63+
| `bodyMd` | `--p-font-size-100` | 14 | 0.875 | `--p-line-height-2` | `--p-font-weight-regular` | No |
64+
| `bodySm` | `--p-font-size-75` | 12 | 0.75 | `--p-line-height-1` | `--p-font-weight-regular` | No |
65+
66+
---
67+
4868
## Mapping from previous type components
4969

5070
These are suggested replacements for existing text style components, but ultimately the best replacement should be evaluated based on the context of the usage. The `Text` component also requires setting the semantically appropriate html element through the `as` prop.

0 commit comments

Comments
 (0)