Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Repository files navigation

IMPORTANT !!! react-tooltip is discontinued and is not maintained anymore

Simple react tooltip component

Licensenpm

Demo

Demo

Installation

Install package with npm:

npm i rc-simple-tooltip

Install package with yarn:

yarn add rc-simple-tooltip

Basic Usage

Import Tooltip component:

importTooltipfrom'rc-simple-tooltip';

Wrap your component with Tooltip:

<Tooltiptrigger="hover"content="Tooltip content"><button>Complete action</button></Tooltip>

Tooltip works with any component that supports refs. For custom functional components you need to forward ref:

constButton=React.forwardRef(({children, ...props},ref)=><button{...props}ref={ref}>{children}</button>);<Tooltiptrigger="hover"content="Tooltip content"><Button>Complete action</Button></Tooltip>

Tooltip can be used without any children:

<Tooltiptopcontent="Tooltip content"/>

Additionally import styles.css to apply default styling:

import'rc-simple-tooltip/dist/styles.css';

Props

NameTypeDefaultDescription
activeBooleantrueShow tooltip
timeoutInt0Time delay before hiding tooltip in hover mode
contentNodenullTooltip content
position'left'|'right'|'top'|'bottom'nullTooltip position
trigger'click'|'focus'|'hover'nullTooltip activation trigger
classNameStringnullclassName value
stylesObjectnullstyles value

Running locally

With yarn:

yarn start

With npm:

npm start

About

React tooltip component

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages