Skip to content

Conversation

@RobinMalfait
Copy link
Member

This PR adds a new @container-size utility instead of @container-[size].

The main reason we didn't do this before is because we only have container width related container queries, and not block based ones so we never needed size and inline-size was enough.

However, @container-size is still useful if you are using container query related units such as cqb which are using the block size of the container not the inline size.

I also added a little helper such that @container-size is only available in insiders and 4.2.0 (and later) so 4.1.x releases won't have this utility yet. This will require some CHANGELOG changes such that we don't include this when releasing the next minor release.

@RobinMalfait RobinMalfait requested a review from a team as a code owner September 8, 2025 11:20
This allows you to write `@container-size` instead of
`@container-[size]`. While we don't have block-based container query
variants, this is still useful for when you are using `cqb` units.
@RobinMalfait RobinMalfait force-pushed the feat/add-container-size branch from b6a7091 to d775834 Compare September 8, 2025 11:21
return { major: Number(major), minor: Number(minor), patch: Number(patch), prerelease }
})

export function greaterThanOrEqual(a: string, b: string) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't want to pull in a full semver package just to test the major, minor patch and a pre-release channel.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we need to ship runtime checks for this, the feature flagging setup we used for preparing the 4.1 branch was also enabling it in the insiders build wasn't it? We'd document the feature as not released yet until we eventually cut the 4.2 release. This way we avoid any runtime checks and can even compile it out for patch releases

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Did it ship for insiders as well? 🤔

If that's the case, then yeah that's even better. I think we got rid of all that code though, right?

This is semi-runtime, it does a runtime check, but the version of package.json is inlined at build-time already so there is no IO involved anymore.

Will update this with the build-time feature flags instead 👍

Copy link
Member

Choose a reason for hiding this comment

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

} else if (candidate.value.kind === 'named' && candidate.value.value === 'normal') {
value = 'normal'
} else if (
featureFlagVersion('4.2.0', '0.0.0-insiders') &&
Copy link
Member Author

Choose a reason for hiding this comment

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

The main reason I added this is such that we can merge these kinds of PRs instead of keeping them open until we are ready to release a 4.2.x with new features.

Copy link
Member Author

Choose a reason for hiding this comment

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

This also ensures that if we want to make changes to the API, that we can do that until we release a next minor version.

CHANGELOG.md Outdated

### Added

- Add `@container-size` utility ([#18901](https://github.com/tailwindlabs/tailwindcss/pull/18901))
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this here, but open to suggestions on how we would tackle this because this should only be released once we release 4.2.x, not in a 4.1.x patch release.

Copy link
Member

Choose a reason for hiding this comment

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

@RobinMalfait RobinMalfait enabled auto-merge (squash) September 9, 2025 12:18
@RobinMalfait RobinMalfait merged commit b7c7e48 into main Sep 9, 2025
7 checks passed
@RobinMalfait RobinMalfait deleted the feat/add-container-size branch September 9, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants