npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rc-component/dropdown

v1.0.3

Published

dropdown ui component for react

Downloads

4,171,832

Readme

特性

  • 基于 @rc-component/trigger 构建。
  • 支持悬停、单击、上下文菜单和自定义触发操作。
  • 接受 React 元素或渲染函数作为下拉覆盖。
  • 支持对齐点行为和触发宽度匹配。

安装

npm install @rc-component/dropdown

使用

import Dropdown from '@rc-component/dropdown';
import '@rc-component/dropdown/assets/index.css';

export default function App() {
  return (
    <Dropdown overlay={<div>Dropdown content</div>} trigger={['click']}>
      <button type="button">Open</button>
    </Dropdown>
  );
}

示例

运行本地 dumi 站点:

npm install
npm start

然后打开 http://localhost:8000

API

额外属性会透传给底层 @rc-component/trigger 组件。

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | alignPoint | 将弹层窗口与点击点对齐 | boolean | false | | animation | 弹层动画名称 | string | - | | arrow | 是否显示下拉箭头 | boolean | false | | getPopupContainer | 呈现下拉列表的容器 | (node: HTMLElement) => HTMLElement | () => document.body | | minOverlayWidthMatchTrigger | 覆盖宽度是否至少应为触发宽度 | boolean | true 除非设置了 alignPoint | | openClassName | 打开下拉菜单时添加到触发器的类名 | string | ${prefixCls}-open | | overlay | 下拉菜单内容 | React.ReactElement \| (() => React.ReactElement) | - | | overlayClassName | 附加弹层类名 | string | - | | overlayStyle | 叠加样式 | React.CSSProperties | - | | placement | 下拉菜单位置 | string | bottomLeft | | prefixCls | 组件类名前缀 | string | rc-dropdown | | transitionName | 弹层过渡类名 | string | - | | trigger | 触发动作 | ActionType \| ActionType[] | ['hover'] | | visible | 受控可见状态 | boolean | - | | onOverlayClick | 点击下拉菜单内容时的回调 | (event: Event) => void | - | | onVisibleChange | 可见性变化时的回调 | (visible: boolean) => void | - |

本地开发

npm install
npm start

dumi 站点默认运行在 http://localhost:8000

npm test
npm run tsc
npm run lint
npm run compile
npm run build

发布

npm run prepublishOnly

包构建完成后,发布流程由 @rc-component/np 通过 rc-np 命令处理。

许可证

@rc-component/dropdown 基于 MIT 许可证发布。