import {Component, Fragment} from 'react'; import Button from 'sentry/components/button'; import Tooltip from 'sentry/components/tooltip'; class CustomThing extends Component { render() { return A class component with no ref; } } class PassThroughComponent extends Component { render() { return this.props.children; } } export default { title: 'Components/Tooltips/Tooltip', component: Tooltip, }; export const _Tooltip = ({...args}) => { return (

With styled component trigger

With class component trigger

Custom React Component

With an SVG element trigger

With element title and native html element

so strong } {...args} >

With overflowing text

Activate showOnlyOnOverflow and drag the right side to make this text overflow. Tooltip will appear on hover when text overflows.

With custom component with text

This text is in a custom react component. Activate showOnlyOnOverflow and drag the right side to make this text overflow.

); }; _Tooltip.args = { title: 'Basic tooltip content', disabled: false, /** Container display mode */ displayMode: undefined, position: 'top', isHoverable: false, showOnlyOnOverflow: false, }; _Tooltip.argTypes = { displayMode: { control: { type: 'select', options: ['block', 'inline-block', 'inline'], }, }, position: { control: { type: 'select', options: [ 'bottom', 'top', 'left', 'right', 'bottom-start', 'bottom-end', 'top-start', 'top-end', 'left-start', 'left-end', 'right-start', 'right-end', 'auto', ], }, }, }; _Tooltip.parameters = { docs: { description: { story: 'Adds a tooltip to any component', }, }, };