React Tooltip Component

6.4.0 · renamed · verified Sun Apr 19

The `rc-tooltip` package provides a highly customizable and unstyled React tooltip component, focusing on core functionality like positioning, event triggers, and state management. It allows developers to integrate robust tooltip behavior while maintaining full control over the visual presentation, aligning with a 'bring your own UI' philosophy. The version requested, 6.4.0, was the last major release under the `rc-tooltip` package name. However, active development and new features for this component have transitioned to the `@rc-component/tooltip` package, currently at version 1.x.x. While `rc-tooltip` 6.4.0 remains functional for its intended purpose, it is effectively superseded, and new projects or those requiring ongoing updates and accessibility enhancements should migrate to the `@rc-component/tooltip` package. The original `rc-tooltip` package's last update was approximately three years ago.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates basic usage of `rc-tooltip` with a button, showing how to define overlay content, placement, and trigger events with custom delays.

import React from 'react';
import ReactDOM from 'react-dom/client';
import Tooltip from 'rc-tooltip';
import 'rc-tooltip/assets/bootstrap.css'; // Or your custom styles

const App = () => (
  <div style={{ margin: 100, display: 'flex', justifyContent: 'center' }}>
    <Tooltip
      placement="right"
      overlay={<span>Tooltip Content</span>}
      trigger={['hover', 'focus']}
      mouseEnterDelay={0.1}
      mouseLeaveDelay={0.1}
      destroyTooltipOnHide={true}
    >
      <button type="button" style={{ padding: '10px 20px', cursor: 'pointer' }}>
        Hover Me for Tooltip
      </button>
    </Tooltip>
  </div>
);

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);

view raw JSON →