Skip to main content

Pad

The pad element is similar to a touch pad, supports pointer capture and emits the delta distance between each movement event or since last time the movement property was requested.

{"x":0,"y":0}
<xyba-pad id="pad-movement" capture> {"x":0,"y":0} </xyba-pad>

Install

npm install xyba-elements

Importing

Once installed, you can import via xyba-elements.

// Custom Elements
import "xyba-elements/elements/pad/pad.js";

// React
import { Pad } from "xyba-elements/react";

Or import from CDN,

<script src="https://cdn.jsdelivr.net/npm/xyba-elements/dist/cdn/elements/pad/pad.js">

Properties / Attributes

propertyattributetypedefaultdescriptionreadonly
disableddisabledbooleanfalseIf the pad is disabled
capturecapturebooleanfalseWether the pointer should be captured
movement{ x: number; y: number }The movement of the pad since last time it was requested.readonly

CSS Slots

namedescription
The default slot.

Events

namedescriptiontype
movementDispatches when the pointer moves.PadMovementEvent