Skip to content

Commit

Permalink
[SwitchBase] Add missing parameter to docs
Browse files Browse the repository at this point in the history
The `onChange` function signature in SwitchBase api documentation is missing the second `checked` parameter.
SwitchBase is used by Radio and Switch components so this updates their api descriptions.
  • Loading branch information
samuliasmala committed Apr 14, 2020
1 parent a4af02c commit 90f8677
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/radio.md
Expand Up @@ -39,7 +39,7 @@ The `MuiRadio` name can be used for providing [default props](/customization/glo
| <span class="prop-name">inputProps</span> | <span class="prop-type">object</span> | | [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. |
| <span class="prop-name">inputRef</span> | <span class="prop-type">ref</span> | | Pass a ref to the `input` element. |
| <span class="prop-name">name</span> | <span class="prop-type">string</span> | | Name attribute of the `input` element. |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the state is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). You can pull out the new checked state by accessing `event.target.checked` (boolean). |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the state is changed.<br><br>**Signature:**<br>`function(event: object, checked: boolean) => void`<br>*event:* The event source of the callback.<br>*checked:* The new checked state after the change. You can pull out the new value by accessing `event.target.value` (string). You can pull out the new checked state by accessing `event.target.checked` (boolean). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">size</span> | <span class="prop-type">'medium'<br>&#124;&nbsp;'small'</span> | <span class="prop-default">'medium'</span> | The size of the radio. `small` is equivalent to the dense radio styling. |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the component. The DOM API casts this to a string. |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/switch.md
Expand Up @@ -39,7 +39,7 @@ The `MuiSwitch` name can be used for providing [default props](/customization/gl
| <span class="prop-name">id</span> | <span class="prop-type">string</span> | | The id of the `input` element. |
| <span class="prop-name">inputProps</span> | <span class="prop-type">object</span> | | [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. |
| <span class="prop-name">inputRef</span> | <span class="prop-type">ref</span> | | Pass a ref to the `input` element. |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the state is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). You can pull out the new checked state by accessing `event.target.checked` (boolean). |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the state is changed.<br><br>**Signature:**<br>`function(event: object, checked: boolean) => void`<br>*event:* The event source of the callback.<br>*checked:* The new checked state after the change. You can pull out the new value by accessing `event.target.value` (string). You can pull out the new checked state by accessing `event.target.checked` (boolean). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">size</span> | <span class="prop-type">'medium'<br>&#124;&nbsp;'small'</span> | <span class="prop-default">'medium'</span> | The size of the switch. `small` is equivalent to the dense switch styling. |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the component. The DOM API casts this to a string. The browser uses "on" as the default value. |
Expand Down
2 changes: 2 additions & 0 deletions packages/material-ui/src/Radio/Radio.js
Expand Up @@ -157,6 +157,8 @@ Radio.propTypes = {
* Callback fired when the state is changed.
*
* @param {object} event The event source of the callback.
* @param {boolean} checked The new checked state after the change.
*
* You can pull out the new value by accessing `event.target.value` (string).
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/material-ui/src/Switch/Switch.js
Expand Up @@ -253,6 +253,8 @@ Switch.propTypes = {
* Callback fired when the state is changed.
*
* @param {object} event The event source of the callback.
* @param {boolean} checked The new checked state after the change.
*
* You can pull out the new value by accessing `event.target.value` (string).
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/material-ui/src/internal/SwitchBase.d.ts
Expand Up @@ -41,6 +41,8 @@ export interface SwitchBaseProps
* Callback fired when the state is changed.
*
* @param {object} event The event source of the callback.
* @param {boolean} checked The new checked state after the change.
*
* You can pull out the new value by accessing `event.target.value` (string).
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
*/
Expand Down

0 comments on commit 90f8677

Please sign in to comment.