1.0.1 • Published 5 years ago

@rn-components-kit/tooltip v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Tooltip

NPM version

English | 中文

Tooltips display infomation when users tap on an element. It supports the following features:

  • top and bottom two directions to place tooltip content
  • fully customized toopltip content

How to use

npm install @rn-components-kit/tooltip --save
PreviewCode
Demo1 Code

Props

Methods

Reference

Props

style

Allows you to customize style

TypeRequiredDefault
objectno-

popup

Content to show when tooltip pressed. If it is a string, it will be wrapped within Text component. You can also pass a customized ReactElement

TypeRequiredDefault
string | ReactElementyes-

popupContainerStyle

Customized style for popup content's container

TypeRequiredDefault
objectno-

popupTextStyle

Customized style for popup text (works only when popup is a string)

TypeRequiredDefault
objectno-

showCaret

Determines whether to show display pointer

TypeRequiredDefault
booleannotrue

backgroundColor

Background color of tooptip (also for caret if showCaret is true)

TypeRequiredDefault
stringno'rgba(0,0,0,.8)'

overlayColor

Background color of overlay (you can use rgba to control the opacity)

TypeRequiredDefault
stringno'rgba(0,0,0,.1)'

placement

Controls where to show tooltip

TypeRequiredDefault
enum('top', 'bottom')no'bottom'

onOpen

() => void

A callback will be triggered when tooltip opens

TypeRequiredDefault
functionno() => {}

onClose

() => void

A callback will be triggered when tooltip closes

TypeRequiredDefault
functionno() => {}

Methods

open

open()

Normally, Tooltip component has taken over the work of opening/closing. But in some cases, you can also use this function to open tooltip

close

close()

Normally, Tooltip component has taken over the work of opening/closing. But in some cases, you can also use this function to close tooltip