Browse documentation

Reference / Interactivity

Scroll snap stop

Choose whether a directional scrolling operation can pass over a snap position or must stop there.

Working example

Apply snap-always to the item you want a fast fling to stop at. The scroller still needs a snap axis and the item needs snap alignment.

HTML
<div tabindex="0" role="region" aria-label="One swatch per stop"
  class="flex w-48 max-w-full gap-3 overflow-x-auto border p-2 snap-x snap-mandatory">
  <div class="w-32 shrink-0 bg-neutral-100 p-4 snap-start snap-always">Paper</div>
  <div class="w-32 shrink-0 bg-neutral-800 p-4 text-white snap-start snap-always">Carbon</div>
  <div class="w-32 shrink-0 bg-neutral-200 p-4 snap-start snap-always">Stone</div>
</div>

Class reference

ClassCSS declarations
snap-normalscroll-snap-stop: normal;
snap-alwaysscroll-snap-stop: always;
View full generated CSS
Compiled CSS
.snap-always {
  scroll-snap-stop: always;
}
.snap-normal {
  scroll-snap-stop: normal;
}