react-truncate-tooltip-ifz

1.0.1-al • Public • Published

react-truncate-tooltip-ifz

LIVE EXAMPLE

Description

Change rc-tc-ifn (for search name)

  • You want to display beauty list data. But some data is oversized and break line, you need to clip and show tooltips for them. Using this.

  • Truncate text with ellipsis and show tooltip. (if need)

  • It suitable for dropdown list or table list data. (make width better)


Usage

Install the package

npm install --save react-truncate-tooltip-ifz

Import the module in the place you want to use:

import TooltipIfNeed from "react-truncate-tooltip-ifz";

import "react-truncate-tooltip-ifz/build/styles.css";

Snippet

// const [content, setContent] = useState('This is simple tooltip')

// 1. truncate and display tooltip (ex: width > 100px)
<TooltipIfNeed width="100px" right>
    todosomethingxxxlatexxxx
</TooltipIfNeed>
// display: todosomethingxxx
// tooltip: todosomethingxxxlatexxxx   // or pass props tooltipContent

// 2. no truncate and no tooltip (width <= 100px)
<TooltipIfNeed width="100px" right>
    todo work
</TooltipIfNeed>

/* it suitable for dropdown list or table list data */


props

see all props in react-tooltip-z

  • note props
`trigger` and `showSync`: now only supports hover so it's disabled.
props type description
tagName String Tag wrap & fix size (default span)
tagTruncate String Tag child name (default span)
width px, % Set width with for child. Default no. (You should set width)

note

you should add className and set width from className.


RUN

LIVE EXAMPLE


License

MIT

Package Sidebar

Install

npm i react-truncate-tooltip-ifz

Weekly Downloads

9

Version

1.0.1-al

License

MIT

Unpacked Size

16.8 kB

Total Files

6

Last publish

Collaborators

  • delpikye