Touch Action

Set how touch gestures are handled by an element.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari

Usage

Auto

Allow all default touch behaviors.

<div class="ta-auto">Full touch support</div>

None

Disable all touch interactions.

<div class="ta-none">Touch disabled</div>

Pan X

Allow only horizontal panning.

Scroll horizontally only

<div class="h-32 w-full ta-px ov-s">
<div class="w-128 p-4 bg-indigo/10 br-1">
Scroll horizontally only
</div>
</div>

Pan Y

Allow only vertical panning.

Scroll vertically only

<div class="h-32 w-full ta-py ov-s">
<div class="h-64 p-4 bg-indigo/10 br-1">
Scroll vertically only
</div>
</div>

Directional Panning

Control panning direction with granular utilities.

  • ta-pl: Panning to the left.
  • ta-pr: Panning to the right.
  • ta-pu: Panning upward.
  • ta-pd: Panning downward.
<div class="ta-pr ov-s">
Swipe right only
</div>

Pinch Zoom

Enable pinch-to-zoom gestures.

<div class="ta-pz">
Pinch to zoom
</div>

Manipulation

Enable panning and pinch zooming while disabling double-tap-to-zoom.

<div class="ta-m">
Pan and pinch, no double-tap zoom
</div>

Common use cases

Custom scroll containers

<div class="h-64 ta-py ov-s">
<div class="h-128">
<!-- Vertical scrolling content -->
</div>
</div>

Horizontal carousels

<div class="ta-px ov-s">
<div class="d-f g-4 w-128">
<!-- Horizontal carousel items -->
</div>
</div>

Prevent scroll interference

<canvas class="ta-none">
<!-- Canvas for drawing, disable touch scrolling -->
</canvas>

Responsiveness

Use breakpoint prefixes to target different screen sizes. Styles apply from the breakpoint & up.

Target viewport sizes with breakpoint prefixes.

sm:ta-*
Small640px
md:ta-*
Medium768px
lg:ta-*
Large1024px
xxl:ta-*
Extra Large1536px

Hover State

Apply styles conditionally on hover using the h: prefix.

Add the h: prefix to apply styles only when the user hovers over the element.

Syntax:h:ta-*