diff --git a/packages/grafana-ui/src/components/Switch/Switch.tsx b/packages/grafana-ui/src/components/Switch/Switch.tsx index e3b54790c96..2573eb9238b 100644 --- a/packages/grafana-ui/src/components/Switch/Switch.tsx +++ b/packages/grafana-ui/src/components/Switch/Switch.tsx @@ -1,5 +1,7 @@ import React, { PureComponent } from 'react'; import uniqueId from 'lodash/uniqueId'; +import { Tooltip } from '../Tooltip/Tooltip'; +import * as PopperJS from 'popper.js'; export interface Props { label: string; @@ -7,6 +9,8 @@ export interface Props { className?: string; labelClass?: string; switchClass?: string; + tooltip?: string; + tooltipPlacement?: PopperJS.Placement; transparent?: boolean; onChange: (event?: React.SyntheticEvent) => void; } @@ -26,7 +30,16 @@ export class Switch extends PureComponent { }; render() { - const { labelClass = '', switchClass = '', label, checked, transparent, className } = this.props; + const { + labelClass = '', + switchClass = '', + label, + checked, + transparent, + className, + tooltip, + tooltipPlacement, + } = this.props; const labelId = this.state.id; const labelClassName = `gf-form-label ${labelClass} ${transparent ? 'gf-form-label--transparent' : ''} pointer`; @@ -35,7 +48,18 @@ export class Switch extends PureComponent { return (