extra-prop-types

Extra prop type validators for React

MIT License

Downloads
934
Stars
1
Committers
1

Extra Prop Types

Extra Prop Types for React Components


Installation

$ yarn add extra-prop-types

or

$ npm install --save extra-prop-types

Usage


import * as ExtraPropTypes from 'extra-prop-types';


const SomeComponent = (colorProp) => (
    <div style={{ backgroundColor: colorProp }}></div>
)

SomeComponent.propTypes = {
    colorProp: ExtraPropTypes.color.isRequired
}


Types

color accepts:

  • hex
    • #ffffff
  • rgb
    • rgb(255, 255, 255)
  • rgba
    • rgba(255, 255, 255, 1)
  • hsl
    • hsl(0, 100%, 100%)
  • hsla
    • hsla(0, 0%, 100%, 1)

Contributing

Want to add a type? To get started...

Step 1

  • Option 1

    • 🍴 Fork this repo!
  • Option 2

    • 👯 Clone this repo to your local machine using https://github.com/brendon1555/extra-prop-types.git

Step 2

  • HACK AWAY! 🔨🔨🔨

Step 3

  • 🔃 Create a new pull request using https://github.com/brendon1555/extra-prop-types/compare/.

Contributors

Brendon Lees
Brendon1555
github.com/brendon1555

Support

Reach out to me at one of the following places!

  • Website at brendon1555.com
  • Twitter at @brendon1555

License

Package Rankings
Top 9.42% on Npmjs.org
Badges
Extracted from project README
GitHub issues devDependencies peerDependencies License Brendon1555 License