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

@rc-component/trigger

Package Overview
Dependencies
Maintainers
0
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/trigger

base abstract trigger component for react

  • 2.2.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by2.41%
Maintainers
0
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 09 Dec 2024

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