---
title: Touch
description: Touch protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

Touch Target Configuration Schema

Ensures touch targets meet WCAG 2.5.5 minimum size requirements (44x44px).

<Callout type="info">
**Source:** `packages/spec/src/ui/touch.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { GestureConfig, GestureType, LongPressGestureConfig, PinchGestureConfig, SwipeDirection, SwipeGestureConfig, TouchInteraction, TouchTargetConfig } from '@objectstack/spec/ui';
import type { GestureConfig, GestureType, LongPressGestureConfig, PinchGestureConfig, SwipeDirection, SwipeGestureConfig, TouchInteraction, TouchTargetConfig } from '@objectstack/spec/ui';

// Validate data
const result = GestureConfig.parse(data);
```

---

## GestureConfig

Per-gesture configuration

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `Enum<'swipe' \| 'pinch' \| 'long_press' \| 'double_tap' \| 'drag' \| 'rotate' \| 'pan'>` | ✅ | Gesture type to configure |
| **label** | `string` | optional | Descriptive label for the gesture action |
| **enabled** | `boolean` | ✅ | Whether this gesture is active |
| **swipe** | `Object` | optional | Swipe gesture settings (when type is swipe) |
| **pinch** | `Object` | optional | Pinch gesture settings (when type is pinch) |
| **longPress** | `Object` | optional | Long press settings (when type is long_press) |


---

## GestureType

Touch gesture type

### Allowed Values

* `swipe`
* `pinch`
* `long_press`
* `double_tap`
* `drag`
* `rotate`
* `pan`


---

## LongPressGestureConfig

Long press gesture recognition settings

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **duration** | `number` | ✅ | Hold duration in milliseconds to trigger long press |
| **moveTolerance** | `number` | optional | Max movement in pixels allowed during press |


---

## PinchGestureConfig

Pinch/zoom gesture recognition settings

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **minScale** | `number` | optional | Minimum scale factor (e.g., 0.5 for 50%) |
| **maxScale** | `number` | optional | Maximum scale factor (e.g., 3.0 for 300%) |


---

## SwipeDirection

### Allowed Values

* `up`
* `down`
* `left`
* `right`


---

## SwipeGestureConfig

Swipe gesture recognition settings

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **direction** | `Enum<'up' \| 'down' \| 'left' \| 'right'>[]` | ✅ | Allowed swipe directions |
| **threshold** | `number` | optional | Minimum distance in pixels to recognize swipe |
| **velocity** | `number` | optional | Minimum velocity (px/ms) to trigger swipe |


---

## TouchInteraction

Touch and gesture interaction configuration

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **gestures** | `Object[]` | optional | Configured gesture recognizers |
| **touchTarget** | `Object` | optional | Touch target sizing and hit area |
| **hapticFeedback** | `boolean` | optional | Enable haptic feedback on touch interactions |
| **ariaLabel** | `string` | optional | Accessible label for screen readers (WAI-ARIA aria-label) |
| **ariaDescribedBy** | `string` | optional | ID of element providing additional description (WAI-ARIA aria-describedby) |
| **role** | `string` | optional | WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert") |


---

## TouchTargetConfig

Touch target sizing configuration (WCAG accessible)

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **minWidth** | `number` | ✅ | Minimum touch target width in pixels (WCAG 2.5.5: 44px) |
| **minHeight** | `number` | ✅ | Minimum touch target height in pixels (WCAG 2.5.5: 44px) |
| **padding** | `number` | optional | Additional padding around touch target in pixels |
| **hitSlop** | `Object` | optional | Invisible hit area extension beyond the visible bounds |


---

