Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrate supports theme keys #18817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
RobinMalfait merged 4 commits into main from feat/upgrade-supports-theme
Aug 28, 2025
Merged

Migrate supports theme keys #18817

RobinMalfait merged 4 commits into main from feat/upgrade-supports-theme
Aug 28, 2025

Conversation

Copy link
Member

@RobinMalfait RobinMalfait commented Aug 28, 2025

This PR is a follow up of #18815 and #18816, but this time let's migrate the supports theme keys.

Let's imagine you have the following Tailwind CSS v3 configuration:

export default {
 content: ['./src/**/*.html'],
 theme: {
 extend: {
 supports: {
 // Automatically handled by bare values (using CSS variable as the value)
 foo: 'foo: var(--foo)', // parentheses are optional
 bar: '(bar: var(--bar))',
 // Not automatically handled because names differ
 baz: 'qux: var(--foo)',
 // ^^^ ^^^ ← different names
 // Custom
 grid: 'display: grid',
 },
 },
 },
}

Then we would generate the following Tailwind CSS v4 CSS:

@custom-variant supports-baz {
 @supports (qux: var(--foo)) {
 @slot;
 }
}
@custom-variant supports-grid {
 @supports (display: grid) {
 @slot;
 }
}

Notice how we didn't generate a custom variant for data-foo or data-bar because those are automatically handled by bare values.

I also went with the longer form of @custom-variant, we could use the single selector approach, but that felt less clear to me.

@custom-variant supports-baz (@supports (qux: var(--foo)));
@custom-variant supports-grid (@supports (display: grid));

@RobinMalfait RobinMalfait requested a review from a team as a code owner August 28, 2025 11:22
Comment on lines -415 to -418
if (BLOCKED_THEME_KEYS.includes(key)) {
return false
}
Copy link
Member Author

@RobinMalfait RobinMalfait Aug 28, 2025

Choose a reason for hiding this comment

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

👋 bye bye blocked theme keys

We still have aria, data and supports handling in: https://github.com/tailwindlabs/tailwindcss/blob/feat%2Fupgrade-supports-theme/packages/tailwindcss/src/compat/theme-variants.ts

This is still necessary in case the config file could not be migrated due to other issues. So didn't get rid of that part.

Base automatically changed from feat/upgrade-data-theme to main August 28, 2025 14:45
@RobinMalfait RobinMalfait enabled auto-merge (squash) August 28, 2025 14:46
@RobinMalfait RobinMalfait merged commit e578238 into main Aug 28, 2025
7 checks passed
@RobinMalfait RobinMalfait deleted the feat/upgrade-supports-theme branch August 28, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@thecrypticace thecrypticace thecrypticace approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /