Skip to content

Commit 4f76980

Browse files
authored
Make leading-none a static utility (#14934)
This PR removes the `--leading-none` variable from the default theme in favor of making `leading-none` a static utility, since it doesn't make sense to change the value of this on a per-project basis. This is consistent with how `none` values work for other utilities in the framework. Some folks in the past have wanted `leading-none` to be `line-height: 0` but technically "leading" is the space between lines, and `line-height: 1` removes all extra space between lines so it feels correct to me (although it means all of the numeric utilities like `leading-6` are not technically correct but I try hard not to think about that too much). If someone wants `line-height: 0` they can use `leading-0` in v4 since the `leading-*` utilities inherit the spacing scale now. --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent e1c74ca commit 4f76980

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6565
- Replace `outline-none` with `outline-hidden`, add new simplified `outline-none` utility ([#14926](https://github.com/tailwindlabs/tailwindcss/pull/14926))
6666
- Revert adding borders by default to form inputs ([#14929](https://github.com/tailwindlabs/tailwindcss/pull/14929))
6767
- Deprecate `shadow-inner` utility ([#14933](https://github.com/tailwindlabs/tailwindcss/pull/14933))
68+
- Remove `--leading-none` from the default theme in favor of a static `leading-none` utility ([#14934](https://github.com/tailwindlabs/tailwindcss/pull/14934))
6869

6970
## [4.0.0-alpha.31] - 2024-10-29
7071

packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
354354
--tracking-wide: .025em;
355355
--tracking-wider: .05em;
356356
--tracking-widest: .1em;
357-
--leading-none: 1;
358357
--leading-tight: 1.25;
359358
--leading-snug: 1.375;
360359
--leading-normal: 1.5;

packages/tailwindcss/src/__snapshots__/index.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ exports[`compiling CSS > \`@tailwind utilities\` is replaced by utilities using
353353
--tracking-wide: .025em;
354354
--tracking-wider: .05em;
355355
--tracking-widest: .1em;
356-
--leading-none: 1;
357356
--leading-tight: 1.25;
358357
--leading-snug: 1.375;
359358
--leading-normal: 1.5;

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3853,6 +3853,7 @@ exports[`getClassList 1`] = `
38533853
"leading-80",
38543854
"leading-9",
38553855
"leading-96",
3856+
"leading-none",
38563857
"leading-px",
38573858
"left-0",
38583859
"left-0.5",

packages/tailwindcss/src/utilities.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14036,16 +14036,16 @@ test('leading', async () => {
1403614036
await compileCss(
1403714037
css`
1403814038
@theme {
14039-
--leading-none: 1;
14039+
--leading-tight: 1.25;
1404014040
--leading-6: 1.5rem;
1404114041
}
1404214042
@tailwind utilities;
1404314043
`,
14044-
['leading-none', 'leading-6', 'leading-[var(--value)]'],
14044+
['leading-tight', 'leading-6', 'leading-[var(--value)]'],
1404514045
),
1404614046
).toMatchInlineSnapshot(`
1404714047
":root {
14048-
--leading-none: 1;
14048+
--leading-tight: 1.25;
1404914049
--leading-6: 1.5rem;
1405014050
}
1405114051
@@ -14059,9 +14059,9 @@ test('leading', async () => {
1405914059
line-height: var(--value);
1406014060
}
1406114061
14062-
.leading-none {
14063-
--tw-leading: var(--leading-none);
14064-
line-height: var(--leading-none);
14062+
.leading-tight {
14063+
--tw-leading: var(--leading-tight);
14064+
line-height: var(--leading-tight);
1406514065
}
1406614066
1406714067
@supports (-moz-orient: inline) {
@@ -14080,10 +14080,10 @@ test('leading', async () => {
1408014080
expect(
1408114081
await run([
1408214082
'leading',
14083-
'-leading-none',
14083+
'-leading-tight',
1408414084
'-leading-6',
1408514085
'-leading-[var(--value)]',
14086-
'leading-none/foo',
14086+
'leading-tight/foo',
1408714087
'leading-6/foo',
1408814088
'leading-[var(--value)]/foo',
1408914089
]),

packages/tailwindcss/src/utilities.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,6 +3609,11 @@ export function createUtilities(theme: Theme) {
36093609
staticUtility('forced-color-adjust-none', [['forced-color-adjust', 'none']])
36103610
staticUtility('forced-color-adjust-auto', [['forced-color-adjust', 'auto']])
36113611

3612+
staticUtility('leading-none', [
3613+
() => atRoot([property('--tw-leading')]),
3614+
['--tw-leading', '1'],
3615+
['line-height', '1'],
3616+
])
36123617
spacingUtility('leading', ['--leading'], (value) => [
36133618
atRoot([property('--tw-leading')]),
36143619
decl('--tw-leading', value),

packages/tailwindcss/theme.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@
405405
--tracking-widest: 0.1em;
406406

407407
/* Leading */
408-
--leading-none: 1;
409408
--leading-tight: 1.25;
410409
--leading-snug: 1.375;
411410
--leading-normal: 1.5;

0 commit comments

Comments
 (0)