Awesome
% tcomb-react-bootstrap
This project adds a type checking layer to the components of react-bootstrap.
If you want to add type checking to your own React components, see here.
Playground
Try the playground here
Constraint examples
Some constraints among others enforced by this library:
Alert
:onDismiss
anddismissAfter
must either or neither passedButtonGroup
: can have onlyButton
childrenCol
: props must be integers between 1 and 12Glyphicon
: can't have childrenNav
: bsStyle must be one ofpills
,tabs
For now the constraints are quite relaxed in order to allow an easier demo, however they can be tighten up to the point of accepting only whitelisted props.
Usage
/** @jsx React.DOM */
// development
var Alert = require('tcomb-react-bootstrap/Alert');
// production
// var Alert = require('react-bootstrap/Alert');
var good = (
<Alert bsStyle="warning">
<strong>Holy guacamole!</strong>
</Alert>
); // => ok!
var bad = (
<Alert bsStyle="warn"> // <-- should be "warning"
<strong>Holy guacamole!</strong>
</Alert>
); // => fail! debugger kicks in
Setup
npm install tcomb-react-bootstrap