Cirrus Tooltip Component

Downloads in past


6.0.0-beta.14 years ago5 years agoMinified + gzip package size for @lightspeed/cirrus-tooltip in KB


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.


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


Import required styles in your .scss:
@import '@lightspeed/cirrus-tooltip/Tooltip.scss';


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.


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


| Prop | Type | Description | | ----------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | | children | React.ReactNode | The content that will trigger the tooltip | | content | string | The content to display within the tooltip | | placement | oneOf(top, top-start, top-end, bottom, bottom-start, bottom-end, left, right) | Tooltip placement, defaults to top | | light | boolean | Displays tooltip on a light background | | active | boolean | Forces tooltip to always display | | tag | string | the tag that will be used by react-popper manager, default is a div |


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

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

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:
| Type | Class | | --------- | ------------------------ | | box | .cr-tooltip | | placement | [data-placement="top"] | | light | .cr-tooltip--light | | arrow | .cr-tooltip__arrow |