🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

@rc-component/trigger

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
t

@rc-component/trigger

base abstract trigger component for react

3.4.0
latest
99

Supply Chain Security

100

Vulnerability

100

Quality

93

Maintenance

100

License

Version published
Weekly downloads
1.4M
-16.34%
Maintainers
4
Weekly downloads
 
Created
Issues
68

What is @rc-component/trigger?

@rc-component/trigger is a React component library that provides a flexible and customizable way to manage trigger actions for popups, tooltips, and other overlay elements. It allows developers to control the behavior and positioning of these elements with ease.

What are @rc-component/trigger's main functionalities?

Basic Trigger

This feature demonstrates a basic trigger that shows a popup when the button is clicked. The `action` prop specifies the trigger action, and the `popup` prop defines the content of the popup.

import React from 'react';
import Trigger from '@rc-component/trigger';

const BasicTrigger = () => (
  <Trigger
    action={['click']}
    popup={<div>Popup Content</div>}
  >
    <button>Click me</button>
  </Trigger>
);

export default BasicTrigger;

Hover Trigger

This feature demonstrates a trigger that shows a popup when the button is hovered over. The `action` prop is set to `hover` to enable this behavior.

import React from 'react';
import Trigger from '@rc-component/trigger';

const HoverTrigger = () => (
  <Trigger
    action={['hover']}
    popup={<div>Hover Popup Content</div>}
  >
    <button>Hover over me</button>
  </Trigger>
);

export default HoverTrigger;

Controlled Trigger

This feature demonstrates a controlled trigger where the visibility of the popup is managed by the component's state. The `popupVisible` prop is used to control the visibility of the popup.

import React, { useState } from 'react';
import Trigger from '@rc-component/trigger';

const ControlledTrigger = () => {
  const [visible, setVisible] = useState(false);

  return (
    <div>
      <button onClick={() => setVisible(!visible)}>Toggle Popup</button>
      <Trigger
        popupVisible={visible}
        popup={<div>Controlled Popup Content</div>}
      >
        <span>Controlled Trigger</span>
      </Trigger>
    </div>
  );
};

export default ControlledTrigger;

Other packages similar to @rc-component/trigger

FAQs

Package last updated on 15 May 2025

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