Tooltip
evergreen-tooltip
is a package exporting a Tooltip
React component.
Tooltips display floating content in relation to a target.
Tooltip appear either at the top, bottom of their target.
The preferred and default side is the bottom.
Design example
Implementation details
- Uses
Positioner
fromevergreen-positioner
- Tooltips use
onMouseLeave
andonMouseEnter
to show and hide the tooltip - Tooltips use a similar implementation to Popovers,
When creating a popover, you must specify both:
- its content, by setting the content prop, and
- its target, as a single child element or a function
Usage
<Tooltip ="My tooltip content. Lorem ipsum dolar set amet."> <Text ="inline-block" ="help"> Hover to trigger </Text></Tooltip>
Prop types
static propTypes = ...PositionerpropTypes content: PropTypesnode isShown: PropTypesbool children: PropTypesnode tooltipProps: PropTypesobject statelessProps: PropTypes
Complete Story
import storiesOf from '@storybook/react'import React from 'react'import Box from 'ui-box'import Text from 'evergreen-typography'import Tooltip from '../src/'