Label.tsx 678 B

12345678910111213141516171819202122232425
  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
  13. className={`gf-form-label width-${props.width ? props.width : '10'} ${props.className ? props.className : ''}`}
  14. >
  15. <span>{props.children}</span>
  16. {props.tooltip && (
  17. <Tooltip className="gf-form-help-icon--right-normal" placement="auto" content={props.tooltip}>
  18. <i className="gicon gicon-question gicon--has-hover" />
  19. </Tooltip>
  20. )}
  21. </span>
  22. );
  23. };