Skip to content

Commit 328186d

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

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

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

+3
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

+23
Original file line numberDiff line numberDiff line change
@@ -7846,6 +7846,29 @@ test('scroll-behavior', async () => {
78467846
).toEqual('')
78477847
})
78487848

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

packages/tailwindcss/src/utilities.ts

+9
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,15 @@ 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', [
2108+
decl('display', 'none'),
2109+
]),
2110+
])
2111+
21032112
staticUtility('truncate', [
21042113
['overflow', 'hidden'],
21052114
['text-overflow', 'ellipsis'],

0 commit comments

Comments
 (0)