npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rc-joystick

v1.2.0

Published

A react joystick widget

Readme

🕹️ rc-joystick

📦 Installation

npm

npm install rc-joystick --save-dev

yarn

yarn add rc-joystick

🔨 Basic usage

import React from 'react';
import Joystick from 'rc-joystick';

export default () => {
  return <Joystick />;
};

📖 Documentation

Joystick props interface

| Property | Description | Type | Default | |----------|-------------|------|---------| | className | Joystick container's extra className | string | - | | controllerClassName | Joystick controller's extra className | string | - | | baseRadius | Joystick base radius | number | 75 | | controllerRadius | Joystick controller radius | number | 35 | | insideMode | Controller will always be inside joystick's base if insideMode is true | boolean | false | | directionCount | Direction count modeFive: Center、Right、Top、Left、BottomNine: Center、Right、RightTop、Top、TopLeft、Left、LeftBottom、Bottom、BottomRight | DirectionCount | DirectionCount.Five | | throttle | Trigger throttle (ms) | number | 0 | | onChange | Trigger when the any of angle/direction/distance state is changing | (val: IJoystickChangeValue) => void | - | | onAngleChange | Trigger when the angle state is changing | (angle?: number) => void | - | | onDirectionChange | Trigger when the direction state is changing | (direction: Direction \| keyof typeof Direction) => void | - | | onDistanceChange | Trigger when the distance state is changing | (distance: number) => void | - | | renderController | Custom render controller | (props: IJoystickControllerProps) => React.ReactNode | - | | renderArrows | Custom arrows render map | ICustomArrowsRenderMap | - | | disabled | Disable joystick | boolean | false | | onActiveChange | Trigger when the active state is changing | (active: boolean) => void | - | | autoReset | Auto reset joystick to origin when joystick is inactive | boolean | false | | lockX | Lock X axis | boolean | false | | lockY | Lock Y axis | boolean | false |

Joystick ref handlers

| Handler | Description | Type | |----------|-------------|------| | reset | Reset joystick controller to origin | () => void |

👻 GhostArea

GhostArea is a transparent touch zone: when the user touches anywhere inside it, a joystick appears at the touch point and follows the finger until released.

Basic usage

import Joystick, { GhostArea } from 'rc-joystick';

export default () => (
  <GhostArea width={400} height={400}>
    <Joystick />
  </GhostArea>
);

Multi-joystick (maxJoystickCount)

Set maxJoystickCount to allow multiple simultaneous joysticks — one per finger touch, up to the limit. Pass a render function as children to give each joystick instance its own callbacks.

import Joystick, { GhostArea } from 'rc-joystick';

export default () => {
  const handleChange = (index: number, val) => {
    console.log(`Joystick ${index}:`, val);
  };

  return (
    <GhostArea width={400} height={400} maxJoystickCount={2}>
      {(index) => (
        <Joystick onChange={(val) => handleChange(index, val)} />
      )}
    </GhostArea>
  );
};

children also accepts a plain ReactNode (backward-compatible). In that case all slot instances share the same props/callbacks.

GhostArea props interface

| Property | Description | Type | Default | |----------|-------------|------|---------| | width | Width of the ghost area | React.CSSProperties['width'] | - | | height | Height of the ghost area | React.CSSProperties['height'] | - | | className | Extra className for the ghost area container | string | - | | maxJoystickCount | Maximum number of simultaneously active joystick instances. Each finger touch (up to this limit) spawns its own joystick at the touch location. | number | 1 | | children | Joystick element(s) to render per slot. Pass a render function (index: number) => ReactNode to give each instance its own props/callbacks. | ReactNode \| ((index: number) => ReactNode) | - |