Usage Guide
This page covers common usage patterns for the v-mobile-table directive. For complete configuration options and type definitions, see API.
Installation
Global Registration
Local Registration
If you don't need global registration, you can import the directive directly in a component:
Usage in Templates
Using UI Library Presets
For UI libraries with built-in presets, simply pass the preset name — no need to manually find scroll container selectors:
For the full list of supported presets and their selectors, see API — TablePreset.
Using Custom Selectors
For UI libraries without built-in presets, use selector to specify the scroll container inside the table:
selector takes priority over preset. If both are provided, the element specified by selector will be used. If neither is provided, the directive's bound element itself is used as the scroll container.
Custom Physics Parameters
Adjust friction and drag threshold based on your use case:
Dynamic Control
Pass false to completely disable the directive — all event listeners and style hijacking will be fully cleaned up:
You can also use the enabled property, which has the same effect:
enabled: false and passing false to the directive are equivalent — both fully destroy the directive instance (removing all event listeners and restoring original styles). You do not need to use this for device detection; the directive's mode: 'auto' handles that automatically.
Device Detection Mode
By default, the directive uses mode: 'auto' which automatically detects the device type and applies the optimal strategy:
- Desktop (pure PC): Dormant — no event binding, zero overhead
- Mobile (phone/tablet): Immediately activate full touch handling
- Hybrid (Surface / touchscreen laptop): Lazy hijacking — only activates after confirming a real touch drag, avoiding interference with mouse/trackpad users
Use mode: 'always' to force-enable touch handling regardless of device type. This is useful for debugging or when you know the target environment:
In most cases, mode: 'auto' (the default) is the recommended choice. Only use 'always' when you have a specific reason to bypass device detection.
Disabling Edge Detection
By default, the directive detects when scrolling reaches the container boundary and hands control back to the browser, enabling native gestures like iOS swipe-back. In fullscreen overlay scenarios (e.g. landscape mode), this is undesirable. Set disableEdgeDetection: true to keep full control:
Only enable this when the table is inside a fullscreen overlay or a context where browser-native edge gestures should be suppressed. In normal page layouts, edge detection improves UX by allowing swipe-back and outer scroll.
CSS Rotation Support
When using CSS transform: rotate() to simulate landscape mode on mobile, the touch coordinate axes no longer align with the element's logical axes. The rotation parameter tells the directive to apply an inverse coordinate transform:
Supported values: 0 (default), 90, -90, 180. For a complete landscape toggle example, see the Landscape Mode guide.