Skip to content

Instantly share code, notes, and snippets.

@pradumangoyal
Created April 1, 2019 07:38
Show Gist options
  • Select an option

  • Save pradumangoyal/5dc363a782bf18f84294956b2a78f426 to your computer and use it in GitHub Desktop.

Select an option

Save pradumangoyal/5dc363a782bf18f84294956b2a78f426 to your computer and use it in GitHub Desktop.
Props proposal for Badge component
const propTypes = {
/**
* Change badge color and that of text accordingly
*/
color: PropTypes.oneOf(['inverse', 'lightest']),
/**
* CSS classes that are applied to the span.
*/
className: PropTypes.oneOfType([
PropTypes.array,
PropTypes.object,
PropTypes.string,
]),
/**
* Name of the icon category. Visit <a href="http://www.lightningdesignsystem.com/resources/icons">Lightning Design System Icons</a>to reference icon categories.
*/
iconCategory: requiredIf(
PropTypes.oneOf(['action', 'custom', 'doctype', 'standard', 'utility']),
(props) => !!props.iconName
),
/**
* CSS classes to be added to icon.
*/
iconClassName: PropTypes.oneOfType([
PropTypes.array,
PropTypes.object,
PropTypes.string,
]),
/**
* Name of the icon. Visit <a href="http://www.lightningdesignsystem.com/resources/icons">Lightning Design System Icons</a> to reference icon names.
*/
iconName: PropTypes.string,
/**
* Path to the icon. This will override any global icon settings.
*/
iconPath: PropTypes.string,
/**
* Position of the icon. If omitted icon will be positioned to the left.
*/
iconPosition: PropTypes.oneOf(['left', 'right']),
/**
* HTML id applied on the badge span.
*/
id: PropTypes.string,
/**
* Description of icon if required.
*/
iconTite: PropTypes.string,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment