Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-trigger

Package Overview
Dependencies
Maintainers
5
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-trigger

base abstract trigger component for react

  • 5.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
decreased by-12.22%
Maintainers
5
Weekly downloads
 
Created

What is rc-trigger?

The rc-trigger npm package is a React component that is used for positioning and aligning popups, tooltips, dropdowns, and other floating elements relative to a target element. It provides a flexible way to control the visibility and behavior of these overlay components.

What are rc-trigger's main functionalities?

Popup Alignment

This feature allows you to align the popup content to the target element. In the code sample, the popup is aligned to the bottom left of the button when clicked, with a small offset.

{"import React from 'react';\nimport Trigger from 'rc-trigger';\nimport 'rc-trigger/assets/index.css';\n\nconst popupContent = <div>Popup Content</div>;\n\nconst Demo = () => (\n  <Trigger\n    action={['click']}\n    popup={popupContent}\n    popupAlign={{\n      points: ['tl', 'bl'],\n      offset: [0, 3],\n    }}\n  >\n    <button>Click me</button>\n  </Trigger>\n);\n\nexport default Demo;"}

Trigger Actions

This feature allows you to specify the actions that will trigger the popup. In the code sample, the popup appears when the input field is either hovered over or focused.

{"import React from 'react';\nimport Trigger from 'rc-trigger';\nimport 'rc-trigger/assets/index.css';\n\nconst popupContent = <div>Popup Content</div>;\n\nconst Demo = () => (\n  <Trigger\n    action={['hover', 'focus']}\n    popup={popupContent}\n    popupAlign={{\n      points: ['tl', 'bl'],\n      offset: [0, 3],\n    }}\n  >\n    <input placeholder='Hover or focus me'/>\n  </Trigger>\n);\n\nexport default Demo;"}

Built-in Animations

This feature allows you to add animations to the popup when it appears or disappears. In the code sample, the 'slide-up' animation is used when the popup is shown or hidden.

{"import React from 'react';\nimport Trigger from 'rc-trigger';\nimport 'rc-trigger/assets/index.css';\n\nconst popupContent = <div>Popup Content</div>;\n\nconst Demo = () => (\n  <Trigger\n    action={['click']}\n    popup={popupContent}\n    popupAlign={{\n      points: ['tl', 'bl'],\n      offset: [0, 3],\n    }}\n    popupAnimation='slide-up'\n  >\n    <button>Click me</button>\n  </Trigger>\n);\n\nexport default Demo;"}

Other packages similar to rc-trigger

Keywords

FAQs

Package last updated on 24 Nov 2022

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