Skip to content

Commit

Permalink
[FormControlLabel] Fix misplaced asterisk when labelPlacement is pr…
Browse files Browse the repository at this point in the history
…ovided (#37831)
  • Loading branch information
ZeeshanTamboli authored Jul 12, 2023
1 parent f950ebf commit 73dd1e1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/mui-material/src/FormControlLabel/FormControlLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import clsx from 'clsx';
import { refType } from '@mui/utils';
import { unstable_composeClasses as composeClasses } from '@mui/base';
import { useFormControl } from '../FormControl';
import Stack from '../Stack';
import Typography from '../Typography';
import capitalize from '../utils/capitalize';
import styled from '../styles/styled';
Expand Down Expand Up @@ -164,11 +165,15 @@ const FormControlLabel = React.forwardRef(function FormControlLabel(inProps, ref
{...other}
>
{React.cloneElement(control, controlProps)}
{label}
{required && (
<AsteriskComponent ownerState={ownerState} aria-hidden className={classes.asterisk}>
&thinsp;{'*'}
</AsteriskComponent>
{required ? (
<Stack direction="row" alignItems="center">
{label}
<AsteriskComponent ownerState={ownerState} aria-hidden className={classes.asterisk}>
&thinsp;{'*'}
</AsteriskComponent>
</Stack>
) : (
label
)}
</FormControlLabelRoot>
);
Expand Down

0 comments on commit 73dd1e1

Please sign in to comment.