Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use configured letter-spacing values for custom font-size utilities
  • Loading branch information
adamwathan committed Nov 22, 2024
commit c2ff6d4000d16f33bb310b0699ad13c0caa5746d
6 changes: 4 additions & 2 deletions packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4033,7 +4033,7 @@ export function createUtilities(theme: Theme) {
let value = theme.resolveWith(
candidate.value.value,
['--text'],
['--line-height', '--tracking', '--font-weight'],
['--line-height', '--letter-spacing', '--font-weight'],
)
if (value) {
let [fontSize, options = {}] = Array.isArray(value) ? value : [value]
Expand Down Expand Up @@ -4067,7 +4067,9 @@ export function createUtilities(theme: Theme) {
),
decl(
'letter-spacing',
options['--tracking'] ? `var(--tw-tracking, ${options['--tracking']})` : undefined,
options['--letter-spacing']
? `var(--tw-tracking, ${options['--letter-spacing']})`
: undefined,
),
decl(
'font-weight',
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/vite/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function App() {
return (
<div className="m-3 p-3 border">
<h1 className="text-blue-500">Hello World</h1>
<h1 className="text-heading3xl">Hello World</h1>
<div className="-inset-x-full -inset-y-full -space-x-full -space-y-full -inset-full"></div>
</div>
)
Expand Down
7 changes: 7 additions & 0 deletions playgrounds/vite/src/index.css
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
@import 'tailwindcss';

@theme {
--text-heading3xl: 2.25rem;
--text-heading3xl--line-height: 3rem;
--text-heading3xl--font-weight: 700;
--text-heading3xl--letter-spacing: -0.08375rem;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@theme {
--text-heading3xl: 2.25rem;
--text-heading3xl--line-height: 3rem;
--text-heading3xl--font-weight: 700;
--text-heading3xl--letter-spacing: -0.08375rem;
}

Let's revert this change

Loading