Skip to content

Commit 991aa8f

Browse files
committed
Add scrollbar-none, scrollbar-thin, scrollbar-width-auto utilities
1 parent e299ea3 commit 991aa8f

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Add support for `addBase` plugins using the `@plugin` directive ([#14172](https://github.com/tailwindlabs/tailwindcss/pull/14172))
1313
- Add support for the `tailwindcss/plugin` export ([#14173](https://github.com/tailwindlabs/tailwindcss/pull/14173))
14+
- Add utilities for the `scrollbar-width` CSS property ([#14183](https://github.com/tailwindlabs/tailwindcss/pull/14183))
1415

1516
## [4.0.0-alpha.19] - 2024-08-09
1617

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,9 @@ exports[`getClassList 1`] = `
16111611
"scroll-py-3",
16121612
"scroll-py-4",
16131613
"scroll-smooth",
1614+
"scrollbar-none",
1615+
"scrollbar-thin",
1616+
"scrollbar-width-auto",
16141617
"select-all",
16151618
"select-auto",
16161619
"select-none",

packages/tailwindcss/src/utilities.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7846,6 +7846,35 @@ test('scroll-behavior', async () => {
78467846
).toEqual('')
78477847
})
78487848

7849+
test('scrollbar-width', async () => {
7850+
expect(await run(['scrollbar-width-auto', 'scrollbar-thin', 'scrollbar-none']))
7851+
.toMatchInlineSnapshot(`
7852+
".scrollbar-none {
7853+
scrollbar-width: none;
7854+
}
7855+
7856+
.scrollbar-none::-webkit-scrollbar {
7857+
display: none;
7858+
}
7859+
7860+
.scrollbar-thin {
7861+
scrollbar-width: thin;
7862+
}
7863+
7864+
.scrollbar-width-auto {
7865+
scrollbar-width: auto;
7866+
}"
7867+
`)
7868+
expect(
7869+
await run([
7870+
'scrollbar-width-none',
7871+
'scrollbar-width-thin',
7872+
'-scrollbar-none',
7873+
'scrollbar-none/foo',
7874+
]),
7875+
).toEqual('')
7876+
})
7877+
78497878
test('truncate', async () => {
78507879
expect(await run(['truncate'])).toMatchInlineSnapshot(`
78517880
".truncate {

packages/tailwindcss/src/utilities.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,13 @@ export function createUtilities(theme: Theme) {
21002100
staticUtility('scroll-auto', [['scroll-behavior', 'auto']])
21012101
staticUtility('scroll-smooth', [['scroll-behavior', 'smooth']])
21022102

2103+
staticUtility('scrollbar-width-auto', [['scrollbar-width', 'auto']])
2104+
staticUtility('scrollbar-thin', [['scrollbar-width', 'thin']])
2105+
staticUtility('scrollbar-none', [
2106+
['scrollbar-width', 'none'],
2107+
() => rule('&::-webkit-scrollbar', [decl('display', 'none')]),
2108+
])
2109+
21032110
staticUtility('truncate', [
21042111
['overflow', 'hidden'],
21052112
['text-overflow', 'ellipsis'],

0 commit comments

Comments
 (0)