react-extra-prop-types
Extra PropTypes for use with React components
Last updated 3 years ago by benwiley4000 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-extra-prop-types 
SYNC missed versions from official npm registry.

react-extra-prop-types

Includes some additional React PropTypes for common use cases. No dependencies.

NPM

PropTypes

  • integer - invalid if prop is non-integer
  • color - invalid if prop is not valid CSS color string (rgb(a), hsl(a), hex). Excludes keywords.
  • datetime - invalid if prop is not string which can be passed to JavaScript Date constructor with valid result
  • uuid - invalid if prop is not valid UUID

Usage

require-ing

var ExtraPropTypes = require('react-extra-prop-types');
var color = ExtraPropTypes.color;
var uuid = ExtraPropTypes.uuid;

// or ...
var color = require('react-extra-prop-types/lib/color');
var uuid = require('react-extra-prop-types/lib/uuid');

use just like normal PropTypes

MyReactComponent.propTypes = {
  id: ExtraPropTypes.integer,
  name: React.PropTypes.string,
  lastFetchTime: ExtraPropTypes.datetime
};

props are optional unless .isRequired is used

MyReactComponent.propTypes = {
  id: ExtraPropTypes.integer.isRequired // can't be left out
};

Development

See CONTRIBUTING.md.

Current Tags

  • 0.3.1                                ...           latest (3 years ago)

4 Versions

  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |