6.0.0-beta.1 • Published 5 years ago

@lightspeed/cirrus-tooltip v6.0.0-beta.1

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

Tooltip

Tooltips are visual helpers when users hover or focus an element. They can also be activated without interaction to give extra information.

Note that tooltips won't be triggered on touch devices.

Installation

First, make sure you have been through the Getting Started steps of adding Cirrus in your application.

If using Yarn:

yarn add @lightspeed/cirrus-tooltip

Or using npm:

npm i -S @lightspeed/cirrus-tooltip

Usage

Import required styles in your .scss:

@import '@lightspeed/cirrus-tooltip/Tooltip.scss';

Content

The content inside of tooltips should NEVER be crucial information. As their discoverability isn’t that great and you don’t have hovers on touchscreen devices.

Directions

The tooltip comes in two styles with multiple directions. The direction indicates the position of the content (e.g. "top" means the content appears above the element)


React Component

Props

PropTypeDescription
childrenReact.ReactNodeThe content that will trigger the tooltip
contentstringThe content to display within the tooltip
placementoneOf(top, top-start, top-end, bottom, bottom-start, bottom-end, left, right)Tooltip placement, defaults to top
lightbooleanDisplays tooltip on a light background
activebooleanForces tooltip to always display
tagstringthe tag that will be used by react-popper manager, default is a div

Example

import React from 'react';
import Tooltip from '@lightspeed/cirrus-tooltip';

const MyComponent = () => (
  <div>
    <Tooltip content="Tooltip">Trigger</Tooltip>
  </div>
);

export default MyComponent;

CSS Component

You can use CSS classes along with popper.js (the library used by the React component) to enable tooltips outside a React application. Here's the available classes:

TypeClass
box.cr-tooltip
placement[data-placement="top"]
light.cr-tooltip--light
arrow.cr-tooltip__arrow
6.0.0-beta.1

5 years ago

6.0.0-beta.0

5 years ago

6.0.0-alpha.0

5 years ago

5.0.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago