Skip to content

Scroll Snap Type

Set scroll snap type

Syntax

visual="snap-type:[value]"

Values

ValueCSS OutputDescription
nonescroll-snap-type: noneNo snapping
xscroll-snap-type: x mandatoryHorizontal snap
yscroll-snap-type: y mandatoryVertical snap
bothscroll-snap-type: both mandatoryBoth axes
x-proximityscroll-snap-type: x proximityHorizontal proximity
y-proximityscroll-snap-type: y proximityVertical proximity

Examples

html
<div visual="snap-type:x">Horizontal snap container</div>

Preview

Snap Type

visual="snap-type:x" - Enable scroll snapping

x
y
both
View Code
html
<div layout="flex" space="g:medium p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
  <div space="p:small" visual="bg:primary text:white rounded:small">x</div>
  <div space="p:small" visual="bg:primary text:white rounded:small">y</div>
  <div space="p:small" visual="bg:primary text:white rounded:small">both</div>
</div>