Skip to content

Commit 988bc5d

Browse files
authored
Merge pull request #470 from facultyai/button-type
Expose type attribute of Button
2 parents 70be538 + 0eec719 commit 988bc5d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Button.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const Button = props => {
2121
setProps,
2222
n_clicks,
2323
target,
24+
type,
2425
...otherProps
2526
} = props;
2627

@@ -38,6 +39,7 @@ const Button = props => {
3839
return (
3940
<RSButton
4041
tag={useLink ? Link : 'button'}
42+
type={useLink ? null : type}
4143
target={useLink ? target : null}
4244
href={disabled ? null : href}
4345
disabled={disabled}
@@ -178,7 +180,13 @@ Button.propTypes = {
178180
/**
179181
* Target attribute to pass on to link if using Button as an external link.
180182
*/
181-
target: PropTypes.string
183+
target: PropTypes.string,
184+
185+
/**
186+
* The default behavior of the button. Possible values are: button, reset,
187+
* submit
188+
*/
189+
type: PropTypes.oneOf(['button', 'reset', 'submit'])
182190
};
183191

184192
export default Button;

0 commit comments

Comments
 (0)