Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Only generate positive `grid-cols-*` and `grid-rows-*` utilities ([#16020](https://github.com/tailwindlabs/tailwindcss/pull/16020))

## [4.0.1] - 2025-01-29

Expand Down
2 changes: 2 additions & 0 deletions packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6995,6 +6995,7 @@ test('grid-cols', async () => {
expect(
await run([
'grid-cols',
'grid-cols-0',
'-grid-cols-none',
'-grid-cols-subgrid',
'grid-cols--12',
Expand Down Expand Up @@ -7043,6 +7044,7 @@ test('grid-rows', async () => {
expect(
await run([
'grid-rows',
'grid-rows-0',
'-grid-rows-none',
'-grid-rows-subgrid',
'grid-rows--12',
Expand Down
2 changes: 2 additions & 0 deletions packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ export function createUtilities(theme: Theme) {
functionalUtility('grid-cols', {
themeKeys: ['--grid-template-columns'],
handleBareValue: ({ value }) => {
if (value === '0') return null
if (!isPositiveInteger(value)) return null
return `repeat(${value}, minmax(0, 1fr))`
},
Expand All @@ -1763,6 +1764,7 @@ export function createUtilities(theme: Theme) {
functionalUtility('grid-rows', {
themeKeys: ['--grid-template-rows'],
handleBareValue: ({ value }) => {
if (value === '0') return null
if (!isPositiveInteger(value)) return null
return `repeat(${value}, minmax(0, 1fr))`
},
Expand Down