Skip to content

Commit

Permalink
Add scroll-behavior utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Sep 4, 2021
1 parent c315db5 commit e9c4fd0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export { default as justifySelf } from './justifySelf'

export { default as overflow } from './overflow'
export { default as overscrollBehavior } from './overscrollBehavior'
export { default as scrollBehavior } from './scrollBehavior'
export { default as textOverflow } from './textOverflow'
export { default as whitespace } from './whitespace'
export { default as wordBreak } from './wordBreak'
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/scrollBehavior.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function () {
return function ({ addUtilities, variants }) {
addUtilities(
{
'.scroll-auto': { 'scroll-behavior': 'auto' },
'.scroll-smooth': { 'scroll-behavior': 'smooth' },
},
variants('scrollBehavior')
)
}
}
3 changes: 3 additions & 0 deletions tests/raw-content.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@
.overscroll-contain {
overscroll-behavior: contain;
}
.scroll-smooth {
scroll-behavior: smooth;
}
.truncate {
overflow: hidden;
text-overflow: ellipsis;
Expand Down
1 change: 1 addition & 0 deletions tests/raw-content.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<div class="outline-none outline-black"></div>
<div class="overflow-hidden"></div>
<div class="overscroll-contain"></div>
<div class="scroll-smooth"></div>
<div class="p-4 py-2 px-3 pt-1 pr-2 pb-3 pl-4"></div>
<div class="place-content-start"></div>
<div class="placeholder-green-300"></div>
Expand Down

0 comments on commit e9c4fd0

Please sign in to comment.