Gathering detailed insights and metrics for rc-trigger
Gathering detailed insights and metrics for rc-trigger
Gathering detailed insights and metrics for rc-trigger
Gathering detailed insights and metrics for rc-trigger
npm install rc-trigger
Typescript
Module System
Min. Node Version
Node Version
NPM Version
93.2
Supply Chain
94.3
Quality
81.5
Maintenance
100
Vulnerability
100
License
@rc-component/trigger@3.5.0
Updated on Jul 15, 2025
v2.2.7
Updated on Jun 17, 2025
@rc-component/trigger@3.4.1
Updated on Jun 17, 2025
@rc-component/trigger@3.4.0
Updated on May 15, 2025
@rc-component/trigger@3.3.0
Updated on May 14, 2025
@rc-component/trigger@3.2.0
Updated on Mar 25, 2025
TypeScript (68.42%)
JavaScript (29.49%)
Less (2.09%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
382 Stars
558 Commits
234 Forks
8 Watchers
23 Branches
57 Contributors
Updated on Jul 15, 2025
Latest Version
5.3.4
Package Id
rc-trigger@5.3.4
Unpacked Size
139.51 kB
Size
25.08 kB
File Count
55
NPM Version
8.19.2
Node Version
16.17.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
React Trigger Component
Include the default styling and then:
1import React from 'react'; 2import ReactDOM from 'react-dom'; 3import Trigger from 'rc-trigger'; 4 5ReactDOM.render(( 6 <Trigger 7 action={['click']} 8 popup={<span>popup</span>} 9 popupAlign={{ 10 points: ['tl', 'bl'], 11 offset: [0, 3] 12 }} 13 > 14 <a href='#'>hover</a> 15 </Trigger> 16), container);
![]() IE / Edge | ![]() Firefox | ![]() Chrome | ![]() Safari | ![]() Electron |
---|---|---|---|---|
IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
online example: http://react-component.github.io/trigger/
npm install
npm start
name | type | default | description |
---|---|---|---|
alignPoint | bool | false | Popup will align with mouse position (support action of 'click', 'hover' and 'contextMenu') |
popupClassName | string | additional className added to popup | |
forceRender | boolean | false | whether render popup before first show |
destroyPopupOnHide | boolean | false | whether destroy popup when hide |
getPopupClassNameFromAlign | getPopupClassNameFromAlign(align: Object):String | additional className added to popup according to align | |
action | string[] | ['hover'] | which actions cause popup shown. enum of 'hover','click','focus','contextMenu' |
mouseEnterDelay | number | 0 | delay time to show when mouse enter. unit: s. |
mouseLeaveDelay | number | 0.1 | delay time to hide when mouse leave. unit: s. |
popupStyle | Object | additional style of popup | |
prefixCls | String | rc-trigger-popup | prefix class name |
popupTransitionName | String|Object | https://github.com/react-component/animate | |
maskTransitionName | String|Object | https://github.com/react-component/animate | |
onPopupVisibleChange | Function | call when popup visible is changed | |
mask | boolean | false | whether to support mask |
maskClosable | boolean | true | whether to support click mask to hide |
popupVisible | boolean | whether popup is visible | |
zIndex | number | popup's zIndex | |
defaultPopupVisible | boolean | whether popup is visible initially | |
popupAlign | Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align) | popup 's align config | |
onPopupAlign | function(popupDomNode, align) | callback when popup node is aligned | |
popup | React.Element | function() => React.Element | popup content | |
getPopupContainer | getPopupContainer(): HTMLElement | function returning html node which will act as popup container | |
getDocument | getDocument(): HTMLElement | function returning document node which will be attached click event to close trigger | |
popupPlacement | string | use preset popup align config from builtinPlacements, can be merged by popupAlign prop | |
builtinPlacements | object | builtin placement align map. used by placement prop | |
stretch | string | Let popup div stretch with trigger element. enums of 'width', 'minWidth', 'height', 'minHeight'. (You can also mixed with 'height minWidth') |
npm test
npm run chrome-test
npm run coverage
open coverage/ dir
After React 16, you won't access popup element's ref in parent component's componentDidMount, which means following code won't work.
1class App extends React.Component { 2 componentDidMount() { 3 this.input.focus(); // error, this.input is undefined. 4 } 5 6 render() { 7 return ( 8 <Trigger 9 action={['click']} 10 popup={<div><input ref={node => this.input = node} type="text" /></div>} 11 > 12 <button>click</button> 13 </Trigger> 14 ) 15 } 16}
Consider wrap your popup element to a separate component:
1class InputPopup extends React.Component { 2 componentDidMount() { 3 this.props.onMount(); 4 } 5 6 render() { 7 return ( 8 <div> 9 <input ref={this.props.inputRef} type="text" /> 10 </div> 11 ); 12 } 13} 14 15class App extends React.Component { 16 handlePopupMount() { 17 this.input.focus(); // error, this.input is undefined. 18 } 19 20 render() { 21 return ( 22 <Trigger 23 action={['click']} 24 popup={<InputPopup inputRef={node => this.input = node} onMount={this.handlePopupMount} />} 25 > 26 <button>click</button> 27 </Trigger> 28 ) 29 } 30}
rc-trigger is released under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
SAST tool is run on all commits
Details
Reason
9 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 7
Reason
Found 7/26 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More