Skip to content

Commit ec3ed57

Browse files
authored
Merge pull request #225 from dxc-technology/rarrojolopez-button-type
[Minor] Type prop added to button
2 parents 4988eb8 + 49d1110 commit ec3ed57

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/src/pages/components/cdk-components/button/api.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ const buttonPropsTable = () => {
1616
</td>
1717
<td>Uses on of the available button modes.</td>
1818
</tr>
19+
<tr>
20+
<td>type: 'button' | 'reset' | 'submit'</td>
21+
<td>
22+
<code>'button'</code>
23+
</td>
24+
<td>This prop corresponds to the 'type' prop of the button in html.</td>
25+
</tr>
1926
<tr>
2027
<td>label: string</td>
2128
<td></td>

lib/src/button/Button.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const DxcButton = ({
1313
mode = "primary",
1414
disabled = false,
1515
iconPosition = "before",
16+
type = "button",
1617
iconSrc = "",
1718
icon,
1819
onClick = "",
@@ -23,9 +24,10 @@ const DxcButton = ({
2324

2425
return (
2526
<ThemeProvider theme={colorsTheme.button}>
26-
<DxCButton margin={margin} mode={mode} disabled={disabled} iconPosition={iconPosition} size={size}>
27+
<DxCButton type={type} margin={margin} mode={mode} disabled={disabled} iconPosition={iconPosition} size={size}>
2728
<Button
2829
disabled={disabled}
30+
type={type}
2931
disableRipple
3032
aria-disabled={disabled ? true : false}
3133
onClick={() => {
@@ -231,11 +233,11 @@ DxcButton.propTypes = {
231233
label: PropTypes.string,
232234
mode: PropTypes.oneOf(["primary", "secondary", "text"]),
233235
disabled: PropTypes.bool,
234-
theme: PropTypes.oneOf(["dark", "light"]),
235236
iconPosition: PropTypes.oneOf(["after", "before"]),
236237
onClick: PropTypes.func,
237238
iconSrc: PropTypes.string,
238239
icon: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
240+
type: PropTypes.oneOf(["button", "reset", "submit"]),
239241
};
240242

241243
export default DxcButton;

0 commit comments

Comments
 (0)