Skip to content

Commit e386840

Browse files
fix: Unset children as required prop to ButtonWithStates (#867)
* Prevents the children prop from being required, to suppress errors when still loading * fix: Empty commit to trigger CI * Example of optional prop not being provided
1 parent ce499e1 commit e386840

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/components/Atoms/ButtonWithStates/ButtonWithStates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const ButtonWithStates = React.forwardRef(({
4949
});
5050

5151
ButtonWithStates.propTypes = {
52-
children: PropTypes.node.isRequired,
52+
children: PropTypes.node,
5353
loadingText: PropTypes.string,
5454
loading: PropTypes.bool,
5555
disabled: PropTypes.bool

src/components/Atoms/ButtonWithStates/ButtonWithStates.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@ import ButtonWithStates from './ButtonWithStates';
1010
>
1111
Enter prize draw
1212
</ButtonWithStates>
13-
```
13+
```
14+
15+
## Optional prop `children`
16+
17+
`children` is an optional prop, this example demonstrates the button will not error without any provided.
18+
19+
```js
20+
import ButtonWithStates from './ButtonWithStates';
21+
22+
<ButtonWithStates type="submit" loading loadingText="Submitting…" />
23+
```

0 commit comments

Comments
 (0)