Label.tsx 625 B

1234567891011121314151617181920212223
  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. className?: string;
  9. }
  10. export const Label: SFC<Props> = props => {
  11. return (
  12. <span className={`gf-form-label width-${props.width ? props.width : '10'}`}>
  13. <span>{props.children}</span>
  14. {props.tooltip && (
  15. <Tooltip className="gf-form-help-icon--right-normal" placement="auto" content={props.tooltip}>
  16. <i className="gicon gicon-question gicon--has-hover" />
  17. </Tooltip>
  18. )}
  19. </span>
  20. );
  21. };