@cypress/react-tooltip

中文文档
0.5.4发布于 2022/11/22MITCommonJS近 30 天下载 1.1万

A tooltip component for React apps

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Options
  4. Development
  5. Changelog

React Tooltip renovate-app badge CircleCI

A tooltip component for React apps utilizing the excellent popper.js library.

Installation

npm install --save @cypress/react-tooltip

Usage

import Tooltip from '@cypress/react-tooltip'

<Tooltip title="Hello World">
  <button>Click me</button>
</Tooltip>

The tooltip will automatically appear when mousing over the button and disappear when mousing out from the button.

Options

optiondefaultdescriptionsupported values
titleundefinedRequired. The tooltip contentAnything renderable by React (string, number, element, etc)
placement'top'The placement of the tooltipPlacements supported by popper.js
visibleundefinedWhether to show the tooltip when rendered. This overrides the default showing/hiding on mouse-over/mouse-outtrue or false
className'tooltip'Class applied to the tooltip
wrapperClassName''Class applied to the <span> that wraps the children of <Tooltip>
updateCueundefinedA prop that indicates that the tooltip's position should update. If the size of the tooltip target changes while the tooltip is showing, the tooltip won't know to update its position. Set this to something that's tied to the target's size or just to a new value to trigger an update of the tooltip's position.

Development

# watches JS and SCSS for changes and compiles
# runs tests for associated
npm run watch

# run all tests
npm test

# creates a demo page at http:localhost:8888/design.html for design purposes
npm run design

Changelog

For latest changelog see cypress-io/react-tooltip/releases. Older changes are below:

0.2.2 - (03/10/17)

  • Add customizable tooltip border

0.2.1 - (03/10/17)

  • Fix issues with class names

0.2.0 - (03/10/17)

  • Allow specifying tooltip class name and wrapper class name

0.1.4 - (03/10/17)

  • Upgrade popper.js to 1.x.x

0.1.1 - (09/29/16)

  • Guard against updating popper state when unmounted

0.1.0 - (09/28/16)

  • Initial release

版本与发布记录

@cypress/react-tooltip 共发布 21 个版本,首次发布于 2016/09/29;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.5.4latest2022/11/223 年前
0.5.32019/09/027 年前
0.5.22019/07/297 年前
0.5.12019/07/297 年前
0.5.02019/06/207 年前
0.0.0-development2019/06/207 年前

关于 @cypress/react-tooltip 的常见问题

@cypress/react-tooltip 是什么?

A tooltip component for React apps

如何安装 @cypress/react-tooltip?

在项目目录运行 npm install @cypress/react-tooltip,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:lodash(^4.17.11)、prop-types(^15.7.2)、react(>= 16)、react-dom(>= 16)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cypress/react-tooltip 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cypress__react-tooltip 是否存在。

@cypress/react-tooltip 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cypress/react-tooltip 可以商用吗?

@cypress/react-tooltip 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cypress/react-tooltip 的下载量有多少?

根据 npm 官方下载统计,@cypress/react-tooltip 在 2026/10/11 – 2026/11/09 这 30 天内被下载 10,842 次,日均约 361 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cypress/react-tooltip 还在维护吗?

最新版本 0.5.4 发布于 2022/11/22(3 年前);至今共发布 21 个版本,其中过去 12 个月发布了 0 个;首次发布于 2016/09/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。