Краткая справка

Класс
Свойства
touch-autotouch-action: auto;
touch-nonetouch-action: none;
touch-pan-xtouch-action: pan-x;
touch-pan-lefttouch-action: pan-left;
touch-pan-righttouch-action: pan-right;
touch-pan-ytouch-action: pan-y;
touch-pan-uptouch-action: pan-up;
touch-pan-downtouch-action: pan-down;
touch-pinch-zoomtouch-action: pinch-zoom;
touch-manipulationtouch-action: manipulation;

Основы использования

Настройка сенсорного действия

Используйте утилиты touch-{action} для управления прокруткой (панорамированием) и масштабированием (сжатием) элемента на сенсорных экранах.

Try panning these images on a touchscreen

touch-auto

touch-none

touch-pan-x

touch-pan-y

<div class="w-full h-48 overflow-auto touch-auto ...">
  <img class="w-[150%] max-w-none h-auto" src="..." />
</div>
<div class="w-full h-48 overflow-auto touch-none ...">
  <img class="w-[150%] max-w-none h-auto" src="..." />
</div>
<div class="w-full h-48 overflow-auto touch-pan-x ...">
  <img class="w-[150%] max-w-none h-auto" src="..." />
</div>
<div class="w-full h-48 overflow-auto touch-pan-y ...">
  <img class="w-[150%] max-w-none h-auto" src="..." />
</div>

Применяя условно

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use focus:touch-pan-x to only apply the touch-pan-x utility on focus.

<div class="focus:touch-pan-x">
  <!-- ... -->
</div>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Контрольные точки и медиа-запросы

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:touch-pan-x to apply the touch-pan-x utility at only medium screen sizes and above.

<div class="md:touch-pan-x">
  <!-- ... -->
</div>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.