• Version 6.2.0
  • Published
  • 153 kB
  • No dependencies
  • MIT license


npm i react-swipeable
yarn add react-swipeable
pnpm add react-swipeable


React Swipe event handler hook



variable DOWN

const DOWN: string;

    variable LEFT

    const LEFT: string;
      const RIGHT: string;

        variable UP

        const UP: string;


          function useSwipeable

          useSwipeable: (options: SwipeableProps) => SwipeableHandlers;


            interface SwipeableHandlers

            interface SwipeableHandlers {}

              method onMouseDown

              onMouseDown: (event: any) => void;

                method ref

                ref: (element: HTMLElement | null) => void;

                  interface SwipeEventData

                  interface SwipeEventData {}

                    property absX

                    absX: number;

                      property absY

                      absY: number;

                        property deltaX

                        deltaX: number;

                          property deltaY

                          deltaY: number;

                            property dir

                            dir: SwipeDirections;

                              property event

                              event: HandledEvents;

                                property first

                                first: boolean;

                                  property initial

                                  initial: Vector2;

                                    property velocity

                                    velocity: number;

                                      property vxvy

                                      vxvy: Vector2;

                                        Type Aliases

                                        type SwipeableProps

                                        type SwipeableProps = Partial<SwipeableCallbacks & ConfigurationOptions>;

                                          type SwipeCallback

                                          type SwipeCallback = (eventData: SwipeEventData) => void;

                                            type SwipeDirections

                                            type SwipeDirections = typeof LEFT | typeof RIGHT | typeof UP | typeof DOWN;

                                              type TapCallback

                                              type TapCallback = ({ event }: { event: HandledEvents }) => void;

                                                type Vector2

                                                type Vector2 = [number, number];

                                                  Package Files (2)

                                                  Dependencies (0)

                                                  No dependencies.

                                                  Dev Dependencies (28)

                                                  Peer Dependencies (1)


                                                  To add a badge like this badgeto your package's README, use the codes available below.

                                                  You may also use to create a custom badge linking to

                                                  • Markdown
                                                  • HTML
                                                    <a href=""><img src="" alt=""></a>