New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@rc-component/trigger

Package Overview
Dependencies
Maintainers
5
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/trigger

Popup trigger and alignment primitive for React.

latest
Source
npmnpm
Version
3.10.1
Version published
Weekly downloads
0
Maintainers
5
Weekly downloads
 
Created
Source

@rc-component/trigger

Ant Design Part of the Ant Design ecosystem.

🎯 Popup trigger and alignment primitive for React.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

  • Built for React and maintained by the rc-component team.
  • Used by Ant Design and other React component libraries.
  • Ships TypeScript declarations with both ES module and CommonJS outputs.
  • Keeps examples, tests, and preview builds aligned with the package source.

Install

npm install @rc-component/trigger

Usage

import Trigger from '@rc-component/trigger';
import '@rc-component/trigger/assets/index.css';

export default () => (
  <Trigger
    action={['click']}
    popup={<span>Popup content</span>}
    popupAlign={{
      points: ['tl', 'bl'],
      offset: [0, 4],
    }}
  >
    <button type="button">Open</button>
  </Trigger>
);

Examples

Run the local dumi site:

npm install
npm start

Then open http://localhost:8000.

API

Trigger

PropDescriptionTypeDefault
actionActions that control popup visibility.ActionType | ActionType[]hover
afterOpenChangeCalled after popup visibility changes.(visible) => void-
afterPopupVisibleChangeDeprecated. Use afterOpenChange instead.(visible) => void-
alignPointAlign popup to mouse position for click, hover, and context menu actions.booleanfalse
arrowRender popup arrow.boolean | ArrowType-
autoDestroyDestroy popup DOM when it is hidden.booleanfalse
blurDelayDelay before hiding on blur, in seconds.number-
builtinPlacementsNamed placement presets.BuildInPlacements{}
defaultPopupVisibleInitial uncontrolled visibility.booleanfalse
disabledTemporarily suppress popup visibility without resetting the current open state.booleanfalse
focusDelayDelay before showing on focus, in seconds.number-
forceRenderRender popup before it is first shown.booleanfalse
freshKeep popup content updated while closed.boolean-
getPopupClassNameFromAlignReturn a popup class name from the current alignment.(align) => string-
getPopupContainerReturn the element that should contain the popup.(node) => HTMLElement-
hideActionActions that hide popup visibility.ActionType[]-
maskRender a mask behind the popup.booleanfalse
maskClosableClose when clicking the mask.booleantrue
maskMotionMotion config for the mask.CSSMotionProps-
mouseEnterDelayDelay before showing on mouse enter, in seconds.number-
mouseLeaveDelayDelay before hiding on mouse leave, in seconds.number0.1
popupPopup content.ReactNode | () => ReactNode-
popupAlignAlignment config compatible with dom-align.AlignType-
popupClassNameClass name added to popup.string-
popupMotionMotion config for the popup.CSSMotionProps-
popupPlacementPlacement key from builtinPlacements.string-
popupStyleInline popup style.React.CSSProperties-
popupVisibleControlled popup visibility.boolean-
prefixClsPopup class name prefix.stringrc-trigger-popup
showActionActions that show popup visibility.ActionType[]-
stretchStretch popup width and/or height from target.string-
uniqueShare popup container through UniqueProvider.boolean-
uniqueContainerClassNameClass name passed to UniqueProvider container.string-
uniqueContainerStyleStyle passed to UniqueProvider container.React.CSSProperties-
zIndexPopup z-index.number-
onOpenChangeCalled when visibility changes.(visible) => void-
onPopupAlignCalled when the popup is aligned.(element, align) => void-
onPopupClickCalled when popup is clicked.React.MouseEventHandler<HTMLDivElement>-
onPopupVisibleChangeDeprecated. Use onOpenChange instead.(visible) => void-

Development

npm install
npm start
npm test
npm run build

The dumi site runs at http://localhost:8000 by default.

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command after the package build.

License

@rc-component/trigger is released under the MIT license.

Keywords

react

FAQs

Package last updated on 17 Jul 2026

Related posts