Scrollable

Scrollable adds overflow: auto to an element and sets up CSS Scroll Snap for you.


Make components scrollable

Just add Scrollable-horizontal or Scrollable-vertical to make an element scrollable with the enhancements we’ve built into Scrollable.

index.html
<!-- Horizontal scrollable component -->
<div class="Scrollable-horizontal"> ... </div>
<!-- Vertical scrollable component -->
<div class="Scrollable-vertical"> ... </div>
Horizontal Scrollable
One
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
Eleven
Vertical Scrollable
One
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
Eleven

CSS Scroll Snap enabled without extra work

Try scrolling the demo to see it work! Checkout the options in the guide to customize CSS Scroll Snap behaviour.

Scroll and see this snap!
One
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
Eleven

Automatic horizontal scrolls

Few people know you can scroll through horizontal content with a mouse wheel. We fixed this by converting vertical scrolls to horizontal scrolls with pretty good finese.

It even reactivates CSS Scroll Snap after scrolling!

Just use the ScrollableHorizontal script to activate this behaviour.

index.html
<div class="Scrollable-horizontal Scrollable-preferHorizontalScroll">
...
</div>

Mouse over this and use your scroll wheel!

One. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Two. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Three. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Four. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Five. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Six. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Seven. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Eight. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Nine. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Ten. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Eleven. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Twelve. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Thirteen. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Fourteen. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Fifteen. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Sixteen. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Seventeen. Lorem ipsum dolor sit amet consectetur adipisicing e
Eighteen. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Nineteen. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Twenty. Lorem ipsum dolor sit amet consectetur adipisicing elit.
Twentyone. Lorem ipsum dolor sit amet consectetur adipisicing elit.

Preserves outlines

Overflow cuts off outlines of elements which extend over their boundaries. We’ve added a small utility that helps to prevent this from happening.

index.html
<div class="
Scrollable-horizontal
Scrollable-preserveOutlines
">
<button>One</button>
<button>Two</button>
<button>Three</button>
...
</div>
Before
Outlines are cut off.
After
Outlines are no longer cut off.