Skip to content

Commit 350c2a4

Browse files
[Fab] Deprecate variant="round"
1 parent ff6462b commit 350c2a4

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

docs/pages/api-docs/fab.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The `MuiFab` name can be used for providing [default props](/customization/globa
3737
| <span class="prop-name">disableRipple</span> | <span class="prop-type">bool</span> | | If `true`, the ripple effect will be disabled. |
3838
| <span class="prop-name">href</span> | <span class="prop-type">string</span> | | The URL to link to when the button is clicked. If defined, an `a` element will be used as the root node. |
3939
| <span class="prop-name">size</span> | <span class="prop-type">'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'</span> | <span class="prop-default">'large'</span> | The size of the button. `small` is equivalent to the dense button styling. |
40-
| <span class="prop-name">variant</span> | <span class="prop-type">'extended'<br>&#124;&nbsp;'round'</span> | <span class="prop-default">'round'</span> | The variant to use. |
40+
| <span class="prop-name">variant</span> | <span class="prop-type">'extended'<br>&#124;&nbsp;'circular'</span> | <span class="prop-default">'circular'</span> | The variant to use. |
4141

4242
The `ref` is forwarded to the root element.
4343

framer/Material-UI.framerfx/code/Fab.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface Props {
1010
disabled?: boolean;
1111
href?: string;
1212
size?: 'small' | 'medium' | 'large';
13-
variant?: 'round' | 'extended';
13+
variant?: 'circular' | 'extended';
1414
icon?: string;
1515
iconTheme?: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
1616
label?: string;
@@ -22,7 +22,7 @@ const defaultProps: Props = {
2222
color: 'default',
2323
disabled: false,
2424
size: 'large',
25-
variant: 'round',
25+
variant: 'circular',
2626
icon: 'add',
2727
iconTheme: 'Filled',
2828
label: 'extended',
@@ -70,7 +70,7 @@ addPropertyControls(Fab, {
7070
variant: {
7171
type: ControlType.Enum,
7272
title: 'Variant',
73-
options: ['round', 'extended'],
73+
options: ['circular', 'extended'],
7474
},
7575
icon: {
7676
type: ControlType.String,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export type FabTypeMap<P = {}, D extends React.ElementType = 'button'> = ExtendB
3737
/**
3838
* The variant to use.
3939
*/
40-
variant?: 'round' | 'extended';
40+
variant?: 'circular' | 'extended';
4141
};
4242
defaultComponent: D;
4343
classKey: FabClassKey;

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import PropTypes from 'prop-types';
33
import clsx from 'clsx';
4+
import { chainPropTypes } from '@material-ui/utils';
45
import withStyles from '../styles/withStyles';
56
import ButtonBase from '../ButtonBase';
67
import capitalize from '../utils/capitalize';
@@ -130,7 +131,7 @@ const Fab = React.forwardRef(function Fab(props, ref) {
130131
disableFocusRipple = false,
131132
focusVisibleClassName,
132133
size = 'large',
133-
variant = 'round',
134+
variant = 'circular',
134135
...other
135136
} = props;
136137

@@ -216,7 +217,15 @@ Fab.propTypes = {
216217
/**
217218
* The variant to use.
218219
*/
219-
variant: PropTypes.oneOf(['extended', 'round']),
220+
variant: chainPropTypes(PropTypes.oneOf(['extended', 'circular']), (props) => {
221+
if (props.variant === 'round') {
222+
throw new Error(
223+
'Material-UI: variant="round" was renamed variant="circular" for consistency.',
224+
);
225+
}
226+
227+
return null;
228+
}),
220229
};
221230

222231
export default withStyles(styles, { name: 'MuiFab' })(Fab);

0 commit comments

Comments
 (0)