Skip to content

Commit 966177d

Browse files
committed
Add scrollbar-none, scrollbar-thin, scrollbar-width-auto utilities
1 parent a8c54ac commit 966177d

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

CHANGELOG.md

+3-1
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+
### Added
11+
12+
- Add utilities for the `scrollbar-width` CSS property ([#14183](https://github.com/tailwindlabs/tailwindcss/pull/14183))
1113

1214
## [4.0.0] - 2025-01-21
1315
## [4.0.0-beta.10] - 2025-01-21

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

+3
Original file line numberDiff line numberDiff line change
@@ -6600,6 +6600,9 @@ exports[`getClassList 1`] = `
66006600
"scroll-py-96",
66016601
"scroll-py-px",
66026602
"scroll-smooth",
6603+
"scrollbar-none",
6604+
"scrollbar-thin",
6605+
"scrollbar-width-auto",
66036606
"select-all",
66046607
"select-auto",
66056608
"select-none",

packages/tailwindcss/src/utilities.test.ts

+29
Original file line numberDiff line numberDiff line change
@@ -8673,6 +8673,35 @@ test('scroll-behavior', async () => {
86738673
).toEqual('')
86748674
})
86758675

8676+
test('scrollbar-width', async () => {
8677+
expect(await run(['scrollbar-width-auto', 'scrollbar-thin', 'scrollbar-none']))
8678+
.toMatchInlineSnapshot(`
8679+
".scrollbar-none {
8680+
scrollbar-width: none;
8681+
}
8682+
8683+
.scrollbar-none::-webkit-scrollbar {
8684+
display: none;
8685+
}
8686+
8687+
.scrollbar-thin {
8688+
scrollbar-width: thin;
8689+
}
8690+
8691+
.scrollbar-width-auto {
8692+
scrollbar-width: auto;
8693+
}"
8694+
`)
8695+
expect(
8696+
await run([
8697+
'scrollbar-width-none',
8698+
'scrollbar-width-thin',
8699+
'-scrollbar-none',
8700+
'scrollbar-none/foo',
8701+
]),
8702+
).toEqual('')
8703+
})
8704+
86768705
test('truncate', async () => {
86778706
expect(await run(['truncate'])).toMatchInlineSnapshot(`
86788707
".truncate {

packages/tailwindcss/src/utilities.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,13 @@ export function createUtilities(theme: Theme) {
19471947
staticUtility('scroll-auto', [['scroll-behavior', 'auto']])
19481948
staticUtility('scroll-smooth', [['scroll-behavior', 'smooth']])
19491949

1950+
staticUtility('scrollbar-width-auto', [['scrollbar-width', 'auto']])
1951+
staticUtility('scrollbar-thin', [['scrollbar-width', 'thin']])
1952+
staticUtility('scrollbar-none', [
1953+
['scrollbar-width', 'none'],
1954+
() => styleRule('&::-webkit-scrollbar', [decl('display', 'none')]),
1955+
])
1956+
19501957
staticUtility('truncate', [
19511958
['overflow', 'hidden'],
19521959
['text-overflow', 'ellipsis'],

0 commit comments

Comments
 (0)