Skip to content

Commit

Permalink
Merge pull request react-bootstrap#926 from AlexKVal/buttonType
Browse files Browse the repository at this point in the history
Add missed propType validation for Button 'type' property
  • Loading branch information
AlexKVal committed Jul 1, 2015
2 parents b8a23d4 + 89ea6ed commit 2f3654d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import CustomPropTypes from './utils/CustomPropTypes';
import ButtonInput from './ButtonInput';

const Button = React.createClass({
mixins: [BootstrapMixin],
Expand All @@ -14,14 +15,18 @@ const Button = React.createClass({
navDropdown: React.PropTypes.bool,
componentClass: CustomPropTypes.elementType,
href: React.PropTypes.string,
target: React.PropTypes.string
target: React.PropTypes.string,
/**
* Defines HTML button type Attribute
* @type {("button"|"reset"|"submit")}
*/
type: React.PropTypes.oneOf(ButtonInput.types)
},

getDefaultProps() {
return {
bsClass: 'button',
bsStyle: 'default',
type: 'button'
bsStyle: 'default'
};
},

Expand Down Expand Up @@ -68,6 +73,7 @@ const Button = React.createClass({
return (
<Component
{...this.props}
type={this.props.type || 'button'}
className={classNames(this.props.className, classes)}>
{this.props.children}
</Component>
Expand Down

0 comments on commit 2f3654d

Please sign in to comment.