Skip to content

Commit c7cbdb8

Browse files
philipp-spiessthecrypticaceadamwathan
authored
Resolve borderRadius when using dot notation inside the theme() function (#14436)
Fixes an issue where `borderRadius` was not properly upgraded when using it in the `theme()` function like this: ``` rounded-[theme(borderRadius.lg)] ``` --------- Co-authored-by: Jordan Pittman <[email protected]> Co-authored-by: Adam Wathan <[email protected]>
1 parent d9aad77 commit c7cbdb8

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Support `borderRadius.*` as an alias for `--radius-*` when using dot notation inside the `theme()` function ([#14436](https://github.com/tailwindlabs/tailwindcss/pull/14436))
1113

1214
## [4.0.0-alpha.24] - 2024-09-11
1315

packages/tailwindcss/src/compat/apply-compat-hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ let themeUpgradeKeys = {
278278
'--background-opacity': '--opacity',
279279
'--border-color': '--color',
280280
'--border-opacity': '--opacity',
281+
'--border-radius': '--radius',
281282
'--border-spacing': '--spacing',
282283
'--box-shadow-color': '--color',
283284
'--caret-color': '--color',

packages/tailwindcss/src/css-functions.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,27 @@ describe('theme function', () => {
241241
`)
242242
})
243243

244+
test('theme(borderRadius.lg)', async () => {
245+
expect(
246+
await compileCss(css`
247+
@theme {
248+
--radius-lg: 0.5rem;
249+
}
250+
.radius {
251+
border-radius: theme(borderRadius.lg);
252+
}
253+
`),
254+
).toMatchInlineSnapshot(`
255+
":root {
256+
--radius-lg: .5rem;
257+
}
258+
259+
.radius {
260+
border-radius: .5rem;
261+
}"
262+
`)
263+
})
264+
244265
describe('for v3 compatibility', () => {
245266
test('theme(blur.DEFAULT)', async () => {
246267
expect(

0 commit comments

Comments
 (0)