Skip to main content

Mobile Touch Support

OGrid uses the Pointer Events API for all drag interactions, providing unified input handling across mouse, touch, and pen devices. All interactions - cell drag-selection, fill handle drag-to-fill, column resize, and column reorder - work on touch devices out of the box with no additional configuration.

How It Works

Pointer Events API

All drag-based interactions use pointerdown, pointermove, and pointerup instead of mouse-specific events. The Pointer Events API automatically handles mouse, touch, and stylus input through a single event model, so every interaction works identically regardless of input device.

Touch-Optimized Sizing

On touch devices (@media (pointer: coarse)), interactive handles are automatically enlarged for easier targeting:

ElementDesktop SizeTouch Size
Fill handle7×7px14×14px
Column resize handle8px wide16px wide

Gesture Prevention

Interactive drag surfaces apply touch-action: none to prevent the browser from interpreting drags as scroll or zoom gestures. This ensures that dragging a fill handle or resizing a column doesn't accidentally scroll the page.

Supported Touch Interactions

InteractionGestureDescription
Cell selectionTap + dragTap a cell, then drag to select a range
Fill handleTap + drag the handleDrag the green square at the bottom-right of the selection to fill cells
Column resizeTap + drag the column borderDrag the right edge of a column header to resize
Column reorderTap + drag a column headerDrag a column header to reorder columns

Quick Example

No special props are needed - touch support is built in. The same code works on desktop and mobile:

import { OGrid } from '@alaarab/ogrid-react-radix';

function App() {
return (
<OGrid
columns={columns}
data={items}
getRowId={(item) => item.id}
cellSelection // drag-select works with touch
/>
);
}
Switching UI libraries

The OGrid component has the same props across all React UI packages. To switch, just change the import:

  • Radix (lightweight, default): from '@alaarab/ogrid-react-radix'
  • Fluent UI (Microsoft 365 / SPFx): from '@alaarab/ogrid-react-fluent' - wrap in <FluentProvider>
  • Material UI (MUI v7): from '@alaarab/ogrid-react-material' - wrap in <ThemeProvider>

CSS Custom Properties

The touch target sizes can be customized with CSS if you need different sizing:

/* Example: make fill handle even larger on touch devices */
@media (pointer: coarse) {
.fillHandle,
.ogrid-fill-handle {
width: 18px;
height: 18px;
}
}

Browser Support

The Pointer Events API is supported in all modern browsers:

BrowserVersion
Chrome55+
Firefox59+
Safari13+
Edge79+
iOS Safari13+
Chrome Android55+