Skip to content

Commit 079966a

Browse files
authored
[Chip] Rename default variant to filled (#22683)
1 parent 509d0c2 commit 079966a

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

docs/pages/api-docs/chip.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The `MuiChip` name can be used for providing [default props](/customization/glob
4040
| <span class="prop-name">label</span> | <span class="prop-type">node</span> | | The content of the label. |
4141
| <span class="prop-name">onDelete</span> | <span class="prop-type">func</span> | | Callback fired when the delete icon is clicked. If set, the delete icon will be shown. |
4242
| <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 chip. |
43-
| <span class="prop-name">variant</span> | <span class="prop-type">'default'<br>&#124;&nbsp;'outlined'<br>&#124;&nbsp;string</span> | <span class="prop-default">'default'</span> | The variant to use. |
43+
| <span class="prop-name">variant</span> | <span class="prop-type">'filled'<br>&#124;&nbsp;'outlined'<br>&#124;&nbsp;string</span> | <span class="prop-default">'filled'</span> | The variant to use. |
4444

4545
The `ref` is forwarded to the root element.
4646

@@ -62,7 +62,7 @@ Any other props supplied will be provided to the root element (native element).
6262
| <span class="prop-name">deletableColorPrimary</span> | <span class="prop-name">.MuiChip-deletableColorPrimary</span> | Styles applied to the root element if `onDelete` and `color="primary"` is defined.
6363
| <span class="prop-name">deletableColorSecondary</span> | <span class="prop-name">.MuiChip-deletableColorSecondary</span> | Styles applied to the root element if `onDelete` and `color="secondary"` is defined.
6464
| <span class="prop-name">outlined</span> | <span class="prop-name">.MuiChip-outlined</span> | Styles applied to the root element if `variant="outlined"`.
65-
| <span class="prop-name">default</span> | <span class="prop-name">.MuiChip-default</span> | Styles applied to the root element if `variant="default"`.
65+
| <span class="prop-name">filled</span> | <span class="prop-name">.MuiChip-filled</span> | Styles applied to the root element if `variant="filled"`.
6666
| <span class="prop-name">outlinedPrimary</span> | <span class="prop-name">.MuiChip-outlinedPrimary</span> | Styles applied to the root element if `variant="outlined"` and `color="primary"`.
6767
| <span class="prop-name">outlinedSecondary</span> | <span class="prop-name">.MuiChip-outlinedSecondary</span> | Styles applied to the root element if `variant="outlined"` and `color="secondary"`.
6868
| <span class="prop-name">avatar</span> | <span class="prop-name">.MuiChip-avatar</span> | Styles applied to the `avatar` element.
@@ -77,8 +77,8 @@ Any other props supplied will be provided to the root element (native element).
7777
| <span class="prop-name">labelSmall</span> | <span class="prop-name">.MuiChip-labelSmall</span> | Styles applied to the label `span` element if `size="small"`.
7878
| <span class="prop-name">deleteIcon</span> | <span class="prop-name">.MuiChip-deleteIcon</span> | Styles applied to the `deleteIcon` element.
7979
| <span class="prop-name">deleteIconSmall</span> | <span class="prop-name">.MuiChip-deleteIconSmall</span> | Styles applied to the `deleteIcon` element if `size="small"`.
80-
| <span class="prop-name">deleteIconColorPrimary</span> | <span class="prop-name">.MuiChip-deleteIconColorPrimary</span> | Styles applied to the deleteIcon element if `color="primary"` and `variant="default"`.
81-
| <span class="prop-name">deleteIconColorSecondary</span> | <span class="prop-name">.MuiChip-deleteIconColorSecondary</span> | Styles applied to the deleteIcon element if `color="secondary"` and `variant="default"`.
80+
| <span class="prop-name">deleteIconColorPrimary</span> | <span class="prop-name">.MuiChip-deleteIconColorPrimary</span> | Styles applied to the deleteIcon element if `color="primary"` and `variant="filled"`.
81+
| <span class="prop-name">deleteIconColorSecondary</span> | <span class="prop-name">.MuiChip-deleteIconColorSecondary</span> | Styles applied to the deleteIcon element if `color="secondary"` and `variant="filled"`.
8282
| <span class="prop-name">deleteIconOutlinedColorPrimary</span> | <span class="prop-name">.MuiChip-deleteIconOutlinedColorPrimary</span> | Styles applied to the deleteIcon element if `color="primary"` and `variant="outlined"`.
8383
| <span class="prop-name">deleteIconOutlinedColorSecondary</span> | <span class="prop-name">.MuiChip-deleteIconOutlinedColorSecondary</span> | Styles applied to the deleteIcon element if `color="secondary"` and `variant="outlined"`.
8484
| <span class="prop-name">focusVisible</span> | <span class="prop-name">.Mui-focusVisible</span> | Pseudo-class applied to the root element if keyboard focused.

docs/src/pages/components/chips/ChipsPlayground.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function ChipsPlayground(props) {
2929
onDelete: 'none',
3030
avatar: 'none',
3131
icon: 'none',
32-
variant: 'default',
32+
variant: 'filled',
3333
size: 'medium',
3434
});
3535
const { color, onDelete, avatar, icon, variant, size } = state;
@@ -47,7 +47,7 @@ function ChipsPlayground(props) {
4747

4848
const colorToCode = color !== 'default' ? `color="${color}" ` : '';
4949
const sizeToCode = size === 'small' ? `size="small" ` : '';
50-
const variantToCode = variant !== 'default' ? `variant="${variant}" ` : '';
50+
const variantToCode = variant !== 'filled' ? `variant="${variant}" ` : '';
5151

5252
let onDeleteToCode;
5353
switch (onDelete) {
@@ -132,9 +132,9 @@ function ChipsPlayground(props) {
132132
onChange={handleChange}
133133
>
134134
<FormControlLabel
135-
value="default"
135+
value="filled"
136136
control={<Radio />}
137-
label="default"
137+
label="filled"
138138
/>
139139
<FormControlLabel
140140
value="outlined"

docs/src/pages/components/chips/chips.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ gain depth while clicked or touched.
4848

4949
You can use the `size` prop to define a small Chip.
5050

51-
### Default variant
51+
### Filled variant
5252

5353
{{"demo": "pages/components/chips/SmallChips.js"}}
5454

docs/src/pages/guides/migration-v4/migration-v4.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,14 @@ const theme = createMuitheme({
358358
+<Fab variant="circular">
359359
```
360360

361+
### Chip
362+
363+
- Rename `default` variant to `filled` for consistency.
364+
```diff
365+
-<Chip variant="default">
366+
+<Chip variant="filled">
367+
```
368+
361369
### Grid
362370

363371
- Rename `justify` prop with `justifyContent` to be aligned with the CSS property name.

packages/material-ui/src/Chip/Chip.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PropTypes } from '..';
44
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
55

66
export interface ChipPropsVariantOverrides {}
7-
export type ChipVariantDefaults = Record<'default' | 'outlined', true>;
7+
export type ChipVariantDefaults = Record<'filled' | 'outlined', true>;
88

99
export interface ChipTypeMap<P = {}, D extends React.ElementType = 'div'> {
1010
props: P & {
@@ -45,8 +45,8 @@ export interface ChipTypeMap<P = {}, D extends React.ElementType = 'div'> {
4545
deletableColorSecondary?: string;
4646
/** Styles applied to the root element if `variant="outlined"`. */
4747
outlined?: string;
48-
/** Styles applied to the root element if `variant="default"`. */
49-
default?: string;
48+
/** Styles applied to the root element if `variant="filled"`. */
49+
filled?: string;
5050
/** Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
5151
outlinedPrimary?: string;
5252
/** Styles applied to the root element if `variant="outlined"` and `color="secondary"`. */
@@ -75,9 +75,9 @@ export interface ChipTypeMap<P = {}, D extends React.ElementType = 'div'> {
7575
deleteIcon?: string;
7676
/** Styles applied to the `deleteIcon` element if `size="small"`. */
7777
deleteIconSmall?: string;
78-
/** Styles applied to the deleteIcon element if `color="primary"` and `variant="default"`. */
78+
/** Styles applied to the deleteIcon element if `color="primary"` and `variant="filled"`. */
7979
deleteIconColorPrimary?: string;
80-
/** Styles applied to the deleteIcon element if `color="secondary"` and `variant="default"`. */
80+
/** Styles applied to the deleteIcon element if `color="secondary"` and `variant="filled"`. */
8181
deleteIconColorSecondary?: string;
8282
/** Styles applied to the deleteIcon element if `color="primary"` and `variant="outlined"`. */
8383
deleteIconOutlinedColorPrimary?: string;
@@ -128,7 +128,7 @@ export interface ChipTypeMap<P = {}, D extends React.ElementType = 'div'> {
128128
size?: 'small' | 'medium';
129129
/**
130130
* The variant to use.
131-
* @default 'default'
131+
* @default 'filled'
132132
*/
133133
variant?: OverridableStringUnion<ChipVariantDefaults, ChipPropsVariantOverrides>;
134134
};

packages/material-ui/src/Chip/Chip.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ export const styles = (theme) => {
152152
marginRight: 3,
153153
},
154154
},
155-
/* Styles applied to the root element if `variant="default"`. */
156-
default: {},
155+
/* Styles applied to the root element if `variant="filled"`. */
156+
filled: {},
157157
/* Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
158158
outlinedPrimary: {
159159
color: theme.palette.primary.main,
@@ -229,14 +229,14 @@ export const styles = (theme) => {
229229
marginRight: 4,
230230
marginLeft: -4,
231231
},
232-
/* Styles applied to the deleteIcon element if `color="primary"` and `variant="default"`. */
232+
/* Styles applied to the deleteIcon element if `color="primary"` and `variant="filled"`. */
233233
deleteIconColorPrimary: {
234234
color: fade(theme.palette.primary.contrastText, 0.7),
235235
'&:hover, &:active': {
236236
color: theme.palette.primary.contrastText,
237237
},
238238
},
239-
/* Styles applied to the deleteIcon element if `color="secondary"` and `variant="default"`. */
239+
/* Styles applied to the deleteIcon element if `color="secondary"` and `variant="filled"`. */
240240
deleteIconColorSecondary: {
241241
color: fade(theme.palette.secondary.contrastText, 0.7),
242242
'&:hover, &:active': {
@@ -286,7 +286,7 @@ const Chip = React.forwardRef(function Chip(props, ref) {
286286
onKeyDown,
287287
onKeyUp,
288288
size = 'medium',
289-
variant = 'default',
289+
variant = 'filled',
290290
...other
291291
} = props;
292292

@@ -528,10 +528,10 @@ Chip.propTypes = {
528528
size: PropTypes.oneOf(['medium', 'small']),
529529
/**
530530
* The variant to use.
531-
* @default 'default'
531+
* @default 'filled'
532532
*/
533533
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
534-
PropTypes.oneOf(['default', 'outlined']),
534+
PropTypes.oneOf(['filled', 'outlined']),
535535
PropTypes.string,
536536
]),
537537
};

0 commit comments

Comments
 (0)