Socket
Socket
Sign inDemoInstall

swiper-action

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swiper-action

simple component for swipe-to-action


Version published
Maintainers
1
Created
Source

swiper-action

Simple react component for swipe-to-action.

⚠️ Disclaimer

This project is still in its early stages. If you have ideas for improvements, open an issue or a pull request!

🚀 Getting started

You can install this package using your favorite package manager:

npm install swiper-action

There are two components:

  • SwiperAction: acts as the outer container for your content.
  • Action: used for the definition of your "swipe-to-actions" actions. The handler for each action receives an InteractionEvent that can either be a MouseEvent or a TouchEvent.
import { SwiperAction, Action } from "swiper-action";

function Example() {
  const actions = [
    <Action action={(e) => handleClick(e)} key={1}>
      <div className="flex h-full flex-col justify-center">
        action
      </div>
    </Action>,
    <Action action={(e) => handleClick(e)} key={2}>
      <div className="flex h-full flex-col justify-center">
        action2
      </div>
    </Action>,
  ];

  return (
    <SwiperAction actions={actions}>
      <div>Content</div>
    </SwiperAction>
  );
}

In the end, this should look something like this image: alt text

Caveats

  1. Currently, the key prop needs to be set manually for the Action component. This will likely be fixed in the future.
  2. The width and height of the outer container for the SwiperAction component need to be set explicitly.

⚙️ Contributing

This project is just getting started. Hence, feel free to open issues and pull requests!

Keywords

FAQs

Package last updated on 28 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc