1. resources
  2. cookbook
  3. scroll containers

Scroll Containers

Create scrolling containers using the scroll snap features from Tailwind.

1
2
3
4
5
6
7
8

Tailwind Utilities

Use the following links to learn more about Tailwind’s scroll behavior and snap features.

FeatureDescription
scroll-behaviorControls the scroll behavior of an element.
scroll-marginControls the scroll offset around items in a snap container.
scroll-paddingControls an element’s scroll offset within a snap container.
scroll-snap-alignControls the scroll snap alignment of an element.
scroll-snap-stopControls whether you can skip past possible snap positions.
scroll-snap-typeControls how strictly snap points are enforced in a snap container.

Carousels

Using Scroll Containers, we can create a fully functional carousel, complete with thumbnail selection. This introduces javascript logic to control the carousel navigation on demand.

full-0full-1full-2full-3full-4full-5

Multi-Column

Per the following example, we can also scroll a group of items as a “set”.

Images courtesy of The Movie Database