Sha256: d24ae6a91ab3f83dd96036a7776c471d8816ec1e67a33903f575f101b009da34

Contents?: true

Size: 726 Bytes

Versions: 63

Compression:

Stored size: 726 Bytes

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Popover } from '@patternfly/react-core';
import { HelpIcon } from '@patternfly/react-icons';

export const HelpLabel = ({ text, id, className }) => {
  if (!text) return null;
  return (
    <Popover id={`${id}-help`} bodyContent={text} aria-label="help-text">
      <button
        onClick={e => e.preventDefault()}
        className={`pf-c-form__group-label-help ${className}`}
      >
        <HelpIcon />
      </button>
    </Popover>
  );
};

HelpLabel.propTypes = {
  id: PropTypes.string.isRequired,
  text: PropTypes.string,
  className: PropTypes.string,
};
HelpLabel.defaultProps = {
  text: '',
  className: '',
};

export default HelpLabel;

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.2.0 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.60 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-10.0.4 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-11.1.0 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-10.0.3 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-11.0.3 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.59 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-11.0.2 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-11.0.1 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-11.0.0 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.58 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-10.0.2 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.57 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-10.0.1 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.56 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.55 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.54 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.53 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-9.0.52 webpack/common/Switcher/HelpLabel.js
foreman_rh_cloud-8.0.52 webpack/common/Switcher/HelpLabel.js