All Projects → romainberger → React Portal Tooltip

romainberger / React Portal Tooltip

Licence: mit
Awesome React tooltip

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Portal Tooltip

postel
tiny react library for building tooltips, flyovers, menus and more
Stars: ✭ 70 (-82.23%)
Mutual labels:  tooltip
Easy Toggle State
A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.
Stars: ✭ 261 (-33.76%)
Mutual labels:  tooltip
React Hint
Tooltip component for React, Preact, Inferno
Stars: ✭ 338 (-14.21%)
Mutual labels:  tooltip
Bootstrap-Confirmation
Bootstrap plugin for on-place confirm boxes using Popover
Stars: ✭ 303 (-23.1%)
Mutual labels:  tooltip
jsPanel3
A jQuery Plugin to create highly configurable floating panels, modals, tooltips, hints/notifiers or contextmenus for use in a backend solution and other web applications.
Stars: ✭ 89 (-77.41%)
Mutual labels:  tooltip
Tooltip Sequence
A simple step by step tooltip helper for any site
Stars: ✭ 287 (-27.16%)
Mutual labels:  tooltip
ak-vue3
组件库包含了 AutoForm 自动表单、BackTop 返回顶部、Breadcrumb 面包屑、 Button 按钮、Cascader 级联选择器、Checkbox 多选框、Collapse 折叠面板、ColorPicker 颜色选择器、DataPicker 时间选择器、Dialog 弹层对话框、Alert 弹框、Echarts 图形图表、Form 表单、Input 输入框、Lazy 图片延时加载、Loading 加载等待、Menu 菜单、Pagination 分页、Progress 进度条、Radio 单选框、Select 选择器、Steps 步骤条、Swiper 图片轮播、Switch 开关、Table 表格、Tabs 标签页、Textarea 文本框、Tooltip 提示、Tr…
Stars: ✭ 24 (-93.91%)
Mutual labels:  tooltip
React Joyride
Create guided tours in your apps
Stars: ✭ 4,215 (+969.8%)
Mutual labels:  tooltip
v-tippy
Vue.js binding for Tippy.js
Stars: ✭ 54 (-86.29%)
Mutual labels:  tooltip
Quantum Nox Firefox Dark Full Theme
These usercontent and userchrome files will give a full themed dark color to Firefox Quantum, menus and dialogs included, as well as the scrollbars. You can also use the JS files to enable multirow tabs and other functions.
Stars: ✭ 328 (-16.75%)
Mutual labels:  tooltip
react-hotkey-tooltip
A global Hotkey provider with built in tooltip for React
Stars: ✭ 34 (-91.37%)
Mutual labels:  tooltip
Tooltips
(unmaintained) A small tooltips library for Android based on Material Design.
Stars: ✭ 14 (-96.45%)
Mutual labels:  tooltip
React Native Walkthrough Tooltip
An inline wrapper for calling out React Native components via tooltip
Stars: ✭ 299 (-24.11%)
Mutual labels:  tooltip
react-popover
Customizable positioning for tooltips, menus, and any other DOM elements inside of a container
Stars: ✭ 13 (-96.7%)
Mutual labels:  tooltip
Mahou
Mahou(魔法) - The magic layout switcher.
Stars: ✭ 335 (-14.97%)
Mutual labels:  tooltip
react-ellipsis-text
React text ellipsify component
Stars: ✭ 28 (-92.89%)
Mutual labels:  tooltip
Rn Tourguide
🚩Make an interactive step by step tour guide for your react-native app (a rewrite of react-native-copilot)
Stars: ✭ 269 (-31.73%)
Mutual labels:  tooltip
Bgatransformerstip Android
Android 通用 PopupWindow,再也不用找 UI 小姐姐切 .9 图片了,大致能为你节省 30 分钟的开发时间
Stars: ✭ 372 (-5.58%)
Mutual labels:  tooltip
Protip
A new generation jQuery Tooltip plugin
Stars: ✭ 357 (-9.39%)
Mutual labels:  tooltip
Popper Core
🍿 JavaScript positioning library for tooltips, popovers, dropdowns, and more
Stars: ✭ 18,903 (+4697.72%)
Mutual labels:  tooltip

React Portal Tooltip

Awesome tooltips.

Build Status npm version npm downloads

react tooltip

Installation

$ npm install react-portal-tooltip

Warning The versions 2.x on npm are compatible with React 16. Corresponding versions for older versions of React:

# For react v15
$ npm install [email protected]

# For react 0.14
$ npm install [email protected]

# For react 0.13
$ npm install [email protected]

Documentation and demo

http://romainberger.github.io/react-portal-tooltip/

Usage

import React from 'react'
import ToolTip from 'react-portal-tooltip'

class MyComponent extends React.Component {
    state = {
        isTooltipActive: false
    }
    showTooltip() {
        this.setState({isTooltipActive: true})
    }
    hideTooltip() {
        this.setState({isTooltipActive: false})
    }
    render() {
        return (
            <div>
                <p id="text" onMouseEnter={this.showTooltip.bind(this)} onMouseLeave={this.hideTooltip.bind(this)}>This is a cool component</p>
                <ToolTip active={this.state.isTooltipActive} position="top" arrow="center" parent="#text">
                    <div>
                        <p>This is the content of the tooltip</p>
                        <img src="image.png"/>
                    </div>
                </ToolTip>
            </div>
        )
    }
}

Props

  • active: boolean, the tooltip will be visible if true
  • position: top, right, bottom or left. Default to right
  • arrow: center, right, left, top or bottom (depending on the position prop). No arrow when the prop is not sepecified
  • align: the alignment of the whole tooltip relative to the parent element. possible values : center, right, left. Default to center.
  • tooltipTimeout: timeout for the tooltip fade out in milliseconds. Default to 500
  • parent: the tooltip will be placed next to this element. Can be the id of the parent or the ref (see example below)
  • group: string, necessary if you want several independent tooltips
  • style: object, allows customizing the tooltip. Checkout the example for details.
  • useHover bool, default to true. If true, the tooltip will stay visible when hovered.

Parent prop

You can use an id or a ref to reference the parent:

id

<div id="hoverMe" onMouseEnter={this.showTooltip} onMouseLeave={this.hideTooltip}>
    Hover me!!!
</div>
<ToolTip active={this.state.isTooltipActive} position="top" arrow="center" parent="#hoverMe">
    <div>
        <p>This is the content of the tooltip</p>
    </div>
</ToolTip>

ref

<div ref={(element) => { this.element = element }} onMouseEnter={this.showTooltip} onMouseLeave={this.hideTooltip}>
    Hover me!!!
</div>
<ToolTip active={this.state.isTooltipActive} position="top" arrow="center" parent={this.element}>
    <div>
        <p>This is the content of the tooltip</p>
    </div>
</ToolTip>

Stateful ToolTip

If you only use the Tooltip for mouse enter / mouse leave, you may not want to handle the state yourself for all elements. In this case, you can use the stateful version which will do it for you:

Import the stateful version:

import { StatefulToolTip } from "react-portal-tooltip"

Then create your parent and give it as a prop to the Tooltip:

const button = <span>Hover me to display the tooltip</span>

return (
  <StatefulToolTip parent={ button }>
    Stateful Tooltip content here!
  </StatefulToolTip>
)

StatefulToolTip takes the same props as ToolTip, plus a className prop that will be applied to the root element wrapping the parent (see the example).

See the example live.

Development

# clone
$ git clone [email protected]:romainberger/react-portal-tooltip.git

# install the dependencies
$ npm install

# go to the example folder, then install more dependencies
$ cd example && npm install

# start the development server with hot reloading
$ npm start

# to build run this command from the root directory
$ npm build

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].