Label.tsx 657 B

12345678910111213141516171819202122232425
  1. import React, { SFC, ReactNode } from 'react';
  2. import { Tooltip } from '@grafana/ui';
  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 placement="auto" content={props.tooltip}>
  16. <div className="gf-form-help-icon--right-normal">
  17. <i className="gicon gicon-question gicon--has-hover" />
  18. </div>
  19. </Tooltip>
  20. )}
  21. </span>
  22. );
  23. };