Skip to content

Commit

Permalink
[Checkbox] Make color="primary" default (#26002)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicasas committed Apr 30, 2021
1 parent 1e360fb commit 6a3b294
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/checkbox.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'"
},
"defaultChecked": { "type": { "name": "bool" } },
"disabled": { "type": { "name": "bool" } },
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/checkboxes/ColorCheckboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function ColorCheckboxes() {
return (
<div>
<Checkbox {...label} defaultChecked />
<Checkbox {...label} defaultChecked color="primary" />
<Checkbox {...label} defaultChecked color="secondary" />
<Checkbox {...label} defaultChecked color="default" />
<Checkbox
{...label}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/checkboxes/ColorCheckboxes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function ColorCheckboxes() {
return (
<div>
<Checkbox {...label} defaultChecked />
<Checkbox {...label} defaultChecked color="primary" />
<Checkbox {...label} defaultChecked color="secondary" />
<Checkbox {...label} defaultChecked color="default" />
<Checkbox
{...label}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/customization/theming/ThemeNesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { green, orange } from '@material-ui/core/colors';

const outerTheme = createTheme({
palette: {
secondary: {
primary: {
main: orange[500],
},
},
});

const innerTheme = createTheme({
palette: {
secondary: {
primary: {
main: green[500],
},
},
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/customization/theming/ThemeNesting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { green, orange } from '@material-ui/core/colors';

const outerTheme = createTheme({
palette: {
secondary: {
primary: {
main: orange[500],
},
},
});

const innerTheme = createTheme({
palette: {
secondary: {
primary: {
main: green[500],
},
},
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/customization/theming/ThemeNestingExtend.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const outerTheme = createTheme({
export default function ThemeNestingExtend() {
return (
<ThemeProvider theme={outerTheme}>
<Checkbox defaultChecked />
<Checkbox defaultChecked color="secondary" />
<ThemeProvider
theme={(theme) =>
createTheme({
Expand All @@ -28,7 +28,7 @@ export default function ThemeNestingExtend() {
})
}
>
<Checkbox defaultChecked color="primary" />
<Checkbox defaultChecked />
<Checkbox defaultChecked color="secondary" />
</ThemeProvider>
</ThemeProvider>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/customization/theming/ThemeNestingExtend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const outerTheme = createTheme({
export default function ThemeNestingExtend() {
return (
<ThemeProvider theme={outerTheme}>
<Checkbox defaultChecked />
<Checkbox defaultChecked color="secondary" />
<ThemeProvider
theme={(theme: Theme) =>
createTheme({
Expand All @@ -28,7 +28,7 @@ export default function ThemeNestingExtend() {
})
}
>
<Checkbox defaultChecked color="primary" />
<Checkbox defaultChecked />
<Checkbox defaultChecked color="secondary" />
</ThemeProvider>
</ThemeProvider>
Expand Down
7 changes: 7 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,13 @@ As the core components use emotion as a styled engine, the props used by emotion
}
```

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

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

### Chip

- Rename `default` variant to `filled` for consistency.
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Checkbox/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface CheckboxProps
};
/**
* 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', CheckboxPropsColorOverrides>;
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
const props = useThemeProps({ props: inProps, name: 'MuiCheckbox' });
const {
checkedIcon = defaultCheckedIcon,
color = 'secondary',
color = 'primary',
icon: iconProp = defaultIcon,
indeterminate = false,
indeterminateIcon: indeterminateIconProp = defaultIndeterminateIcon,
Expand Down Expand Up @@ -142,7 +142,7 @@ Checkbox.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

0 comments on commit 6a3b294

Please sign in to comment.