Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Radio] Make color primary default #26180

Merged
merged 3 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/api-docs/radio.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "union",
"description": "'default'<br>&#124;&nbsp;'primary'<br>&#124;&nbsp;'secondary'<br>&#124;&nbsp;string"
},
"default": "'secondary'"
"default": "'primary'"
},
"disabled": { "type": { "name": "bool" } },
"disableRipple": { "type": { "name": "bool" } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ColorRadioButtons() {
return (
<div>
<Radio {...controlProps('a')} />
<Radio {...controlProps('b')} color="primary" />
<Radio {...controlProps('b')} color="secondary" />
<Radio {...controlProps('c')} color="default" />
<Radio
{...controlProps('d')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ColorRadioButtons() {
return (
<div>
<Radio {...controlProps('a')} />
<Radio {...controlProps('b')} color="primary" />
<Radio {...controlProps('b')} color="secondary" />
<Radio {...controlProps('c')} color="default" />
<Radio
{...controlProps('d')}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/radio-buttons/UseRadioGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Radio from '@material-ui/core/Radio';
const StyledFormControlLabel = styled((props) => <FormControlLabel {...props} />)(
({ theme, checked }) => ({
'.MuiFormControlLabel-label': checked && {
color: theme.palette.secondary.main,
color: theme.palette.primary.main,
},
}),
);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/radio-buttons/UseRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const StyledFormControlLabel = styled((props: StyledFormControlLabelProps) => (
<FormControlLabel {...props} />
))(({ theme, checked }) => ({
'.MuiFormControlLabel-label': checked && {
color: theme.palette.secondary.main,
color: theme.palette.primary.main,
},
}));

Expand Down
9 changes: 9 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,15 @@ As the core components use emotion as a styled engine, the props used by emotion
- Remove `onRendered` prop.
Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component.

### Radio

- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design specification.

```diff
-<Radio />
+<Radio color="secondary />
```

### Rating

- Move the component from the lab to the core. The component is now stable.
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Radio/Radio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface RadioProps
};
/**
* The color of the component. It supports those theme colors that make sense for this component.
* @default 'secondary'
* @default 'primary'
*/
color?: OverridableStringUnion<'primary' | 'secondary' | 'default', RadioPropsColorOverrides>;
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Radio/Radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Radio = React.forwardRef(function Radio(inProps, ref) {
const props = useThemeProps({ props: inProps, name: 'MuiRadio' });
const {
checked: checkedProp,
color = 'secondary',
color = 'primary',
name: nameProp,
onChange: onChangeProp,
size = 'medium',
Expand Down Expand Up @@ -137,7 +137,7 @@ Radio.propTypes /* remove-proptypes */ = {
classes: PropTypes.object,
/**
* The color of the component. It supports those theme colors that make sense for this component.
* @default 'secondary'
* @default 'primary'
*/
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['default', 'primary', 'secondary']),
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Radio/Radio.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('<Radio />', () => {
render,
mount,
muiName: 'MuiRadio',
testVariantProps: { color: 'primary' },
testVariantProps: { color: 'secondary' },
refInstanceof: window.HTMLSpanElement,
skip: ['componentProp', 'componentsProp'],
}));
Expand Down