Repository: tailwindlabs/tailwindcss
Pull request #2145 (2020-08-07 19:13:15)

Add experimental extendedFontSizeScale
This PR extends the font size scale with new `7xl`, `8xl`, and `9xl` values behind an experimental `extendedFontSizeScale` flag.

The goal here is to make sure Tailwind's default design system is capable of keeping up with modern design trends, which lately includes huge text on landing pages.

![image](https://user-images.githubusercontent.com/4323180/89680185-749d2e80-d8c0-11ea-8a8e-53f779a383d8.png)

I've included default line heights for these as well.


Patch:
diff --git a/src/featureFlags.js b/src/featureFlags.js
index 860a36fc..485dc072 100644
--- a/src/featureFlags.js
+++ b/src/featureFlags.js
@@ -3,7 +3,12 @@ import chalk from 'chalk'
 
 const featureFlags = {
   future: ['removeDeprecatedGapUtilities'],
-  experimental: ['uniformColorPalette', 'extendedSpacingScale', 'defaultLineHeights'],
+  experimental: [
+    'uniformColorPalette',
+    'extendedSpacingScale',
+    'defaultLineHeights',
+    'extendedFontSizeScale',
+  ],
 }
 
 export function flagEnabled(config, flag) {
diff --git a/src/flagged/extendedFontSizeScale.js b/src/flagged/extendedFontSizeScale.js
new file mode 100644
index 00000000..5198cad7
--- /dev/null
+++ b/src/flagged/extendedFontSizeScale.js
@@ -0,0 +1,11 @@
+export default {
+  theme: {
+    extend: {
+      fontSize: {
+        '7xl': ['5rem', { lineHeight: '1' }],
+        '8xl': ['6rem', { lineHeight: '1' }],
+        '9xl': ['8rem', { lineHeight: '1' }],
+      },
+    },
+  },
+}
diff --git a/src/index.js b/src/index.js
index a3a70f98..737307b1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -16,6 +16,7 @@ import { flagEnabled } from './featureFlags'
 import uniformColorPalette from './flagged/uniformColorPalette.js'
 import extendedSpacingScale from './flagged/extendedSpacingScale.js'
 import defaultLineHeights from './flagged/defaultLineHeights.js'
+import extendedFontSizeScale from './flagged/extendedFontSizeScale.js'
 
 function getDefaultConfigs(config) {
   const configs = [defaultConfig]
@@ -32,6 +33,10 @@ function getDefaultConfigs(config) {
     configs.unshift(defaultLineHeights)
   }
 
+  if (flagEnabled(config, 'extendedFontSizeScale')) {
+    configs.unshift(extendedFontSizeScale)
+  }
+
   return configs
 }
 


Test patch:
diff --git a/__tests__/fixtures/tailwind-output-flagged.css b/__tests__/fixtures/tailwind-output-flagged.css
index e2add5b7..8877c85f 100644
--- a/__tests__/fixtures/tailwind-output-flagged.css
+++ b/__tests__/fixtures/tailwind-output-flagged.css
@@ -7967,6 +7967,21 @@ video {
   line-height: 1;
 }
 
+.text-7xl {
+  font-size: 5rem;
+  line-height: 1;
+}
+
+.text-8xl {
+  font-size: 6rem;
+  line-height: 1;
+}
+
+.text-9xl {
+  font-size: 8rem;
+  line-height: 1;
+}
+
 .leading-3 {
   line-height: .75rem;
 }
@@ -33029,6 +33044,21 @@ video {
     line-height: 1;
   }
 
+  .sm\:text-7xl {
+    font-size: 5rem;
+    line-height: 1;
+  }
+
+  .sm\:text-8xl {
+    font-size: 6rem;
+    line-height: 1;
+  }
+
+  .sm\:text-9xl {
+    font-size: 8rem;
+    line-height: 1;
+  }
+
   .sm\:leading-3 {
     line-height: .75rem;
   }
@@ -58061,6 +58091,21 @@ video {
     line-height: 1;
   }
 
+  .md\:text-7xl {
+    font-size: 5rem;
+    line-height: 1;
+  }
+
+  .md\:text-8xl {
+    font-size: 6rem;
+    line-height: 1;
+  }
+
+  .md\:text-9xl {
+    font-size: 8rem;
+    line-height: 1;
+  }
+
   .md\:leading-3 {
     line-height: .75rem;
   }
@@ -83093,6 +83138,21 @@ video {
     line-height: 1;
   }
 
+  .lg\:text-7xl {
+    font-size: 5rem;
+    line-height: 1;
+  }
+
+  .lg\:text-8xl {
+    font-size: 6rem;
+    line-height: 1;
+  }
+
+  .lg\:text-9xl {
+    font-size: 8rem;
+    line-height: 1;
+  }
+
   .lg\:leading-3 {
     line-height: .75rem;
   }
@@ -108125,6 +108185,21 @@ video {
     line-height: 1;
   }
 
+  .xl\:text-7xl {
+    font-size: 5rem;
+    line-height: 1;
+  }
+
+  .xl\:text-8xl {
+    font-size: 6rem;
+    line-height: 1;
+  }
+
+  .xl\:text-9xl {
+    font-size: 8rem;
+    line-height: 1;
+  }
+
   .xl\:leading-3 {
     line-height: .75rem;
   }