2.7.0 • Published 9 months ago

@s-ui/react-atom-tooltip v2.7.0

Weekly downloads
934
License
MIT
Repository
-
Last release
9 months ago

AtomTooltip

AtomTooltip is a component that wraps an element and shows a tooltip over it. It has some properties like:

  • it will show the title attribute of the wrapped element by default
  • can also display html as content of the tooltip
  • being displayed on the screen changing sides if necessary
  • being displayed on target focus (through keyboard)
  • delays can be set
  • the arrow position can be set
  • options to select text on tooltip
  • tooltip will be hidden if targeted element is not in the viewport
  • tooltip can be applied over buttons (or any element w/ onClick)

General behaviour will be:

  • Desktop (Non-touch devices) → tooltip will be displayed only on mouseover
  • Mobile (Touch devices) → tooltip will be displayed on touch over target element and hidden w/ another touch outside of it

Installation

$ npm install @s-ui/react-atom-tooltip --save

Usage

After importing the component AtomTooltip like this

import AtomTooltip from '@s-ui/react-atom-tooltip'

Basic usage

<AtomTooltip content="Last month of the year">
  <strong>december</strong>
</AtomTooltip>

HTML in the Tooltip

<AtomTooltip
  content={
    <div>
      Hello <strong>world</strong>!
    </div>
  }
>
  <strong>december</strong>
</AtomTooltip>

Without arrow

<AtomTooltip isArrowed={false} content="Last month of the year">
  <strong>december</strong>
</AtomTooltip>

With delay on show and/or hide

<AtomTooltip delay={{show: 300, hide: 1500}} content="Last month of the year">
  <strong>december</strong>
</AtomTooltip>

Selecting arrow position

<AtomTooltip
  placement={atomTooltipPlacements.TOP_START}
  content="Last month of the year"
>
  <strong>december</strong>
</AtomTooltip>

Tooltip on a "call to action" element

<AtomTooltip content="This menu display some cool options">
  <button onClick={() => alert('👍  displaying menú')}>Menu options</button>
</AtomTooltip>

Find full description and more examples in the demo page.

2.7.0

9 months ago

2.5.0

2 years ago

2.6.0

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago

1.29.0

3 years ago

1.28.0

3 years ago

1.26.0

3 years ago

1.25.0

3 years ago

1.24.0

3 years ago

1.23.0

3 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.0

4 years ago

1.19.0

4 years ago

1.18.0

4 years ago

1.17.0

4 years ago

1.16.0

4 years ago

1.15.0

4 years ago

1.14.0

4 years ago

1.13.0

4 years ago

1.12.0

4 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago