Skip to content

Commit a8fc9d3

Browse files
committed
Add utilities for scrollbar-width
1 parent 3942469 commit a8fc9d3

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/corePlugins.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,19 @@ export let corePlugins = {
12721272
})
12731273
},
12741274

1275+
scrollbar: ({ addUtilities }) => {
1276+
addUtilities({
1277+
'.scrollbar-auto': { 'scrollbar-width': 'auto' },
1278+
'.scrollbar-thin': { 'scrollbar-width': 'thin' },
1279+
'.scrollbar-none': {
1280+
'scrollbar-width': 'none',
1281+
'&::-webkit-scrollbar': {
1282+
display: 'none',
1283+
},
1284+
},
1285+
})
1286+
},
1287+
12751288
textOverflow: ({ addUtilities }) => {
12761289
addUtilities({
12771290
'.truncate': { overflow: 'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap' },

tests/raw-content.test.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,15 @@
367367
.scroll-smooth {
368368
scroll-behavior: smooth;
369369
}
370+
.scrollbar-thin {
371+
scrollbar-width: thin;
372+
}
373+
.scrollbar-none {
374+
scrollbar-width: none;
375+
}
376+
.scrollbar-none::-webkit-scrollbar {
377+
display: none;
378+
}
370379
.truncate {
371380
overflow: hidden;
372381
text-overflow: ellipsis;

tests/raw-content.test.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
<div class="overflow-hidden"></div>
9898
<div class="overscroll-contain"></div>
9999
<div class="scroll-smooth"></div>
100+
<div class="scrollbar-thin"></div>
101+
<div class="scrollbar-none"></div>
100102
<div class="p-4 py-2 px-3 pt-1 pr-2 pb-3 pl-4"></div>
101103
<div class="place-content-start"></div>
102104
<div class="placeholder-green-300"></div>

0 commit comments

Comments
 (0)