Label.tsx 603 B

12345678910111213141516171819202122
  1. import React, { SFC, ReactNode } from 'react';
  2. import Tooltip from '../Tooltip/Tooltip';
  3. interface Props {
  4. tooltip?: string;
  5. for?: string;
  6. children: ReactNode;
  7. width?: number;
  8. }
  9. export const Label: SFC<Props> = props => {
  10. return (
  11. <span className={`gf-form-label width-${props.width ? props.width : '10'}`}>
  12. <span>{props.children}</span>
  13. {props.tooltip && (
  14. <Tooltip className="gf-form-help-icon--right-normal" placement="auto" content={props.tooltip}>
  15. <i className="gicon gicon-question gicon--has-hover" />
  16. </Tooltip>
  17. )}
  18. </span>
  19. );
  20. };