Skip to content

nexa-mobile API Reference

The nexa-mobile package provides mobile-first utility components, gesture detection systems, and hardware-accelerated interactions built natively on Nexa reactivity.

GestureManager

A low-level gesture detection orchestrator designed to listen for touch, swipe, pinch, and custom drag sequences with sub-millisecond responsiveness.

Type Signatures

typescript
export interface GestureEvent {
  type: 'swipe' | 'pinch' | 'tap' | 'doubletap' | 'pan'
  direction?: 'up' | 'down' | 'left' | 'right'
  deltaX: number
  deltaY: number
  scale?: number
  velocityX: number
  velocityY: number
}

export class GestureManager {
  constructor(element: HTMLElement)
  on(event: string, callback: (e: GestureEvent) => void): void
  off(event: string, callback: (e: GestureEvent) => void): void
  destroy(): void
}

Usage Example

javascript
import { GestureManager } from 'nexa-mobile'

const el = document.getElementById('touch-zone')
const gm = new GestureManager(el)

gm.on('swipe', (e) => {
  if (e.direction === 'left') {
    console.log('Swiped left!')
  }
})

Mobile-First UI Components

The nexa-mobile ecosystem includes standard touch components:

NBottomSheet

A premium modal drawer sheet sliding from the bottom of the screen, with full support for inertial touch drag, friction physics, and velocity-based closures.

Props

PropTypeDefaultDescription
modelValuebooleanfalseControls the bottom sheet visibility.
maxHeightstring'75vh'Defines the maximum height limit of the sheet.
snapPointsnumber[][0.3, 0.75]Fractional thresholds (e.g. 30%, 75% height) for snapping.

Released under the MIT License.