Fix missing CheckBoxInput labels

This commit is contained in:
schroda
2026-05-18 21:43:08 +02:00
parent 993601dbfb
commit 98ab6c63d5

View File

@@ -23,13 +23,19 @@ type PrimaryTextProps = {
type Props = BaseProps & type Props = BaseProps &
((LabelProps & PropertiesNever<PrimaryTextProps>) | (PropertiesNever<LabelProps> & PrimaryTextProps)); ((LabelProps & PropertiesNever<PrimaryTextProps>) | (PropertiesNever<LabelProps> & PrimaryTextProps));
export const CheckboxInput = ({ primaryText, secondaryText, sx, ...rest }: Props) => ( export const CheckboxInput = ({ label, primaryText, secondaryText, sx, ...rest }: Props) => (
<FormControlLabel <FormControlLabel
control={<Checkbox {...rest} />} control={<Checkbox {...rest} />}
label={ label={(() => {
primaryText && !secondaryText ? ( if (label) {
primaryText return label;
) : ( }
if (primaryText && !secondaryText) {
return primaryText;
}
return (
<Stack <Stack
sx={{ sx={{
// Padding comes from the MUI Checkbox component // Padding comes from the MUI Checkbox component
@@ -45,8 +51,8 @@ export const CheckboxInput = ({ primaryText, secondaryText, sx, ...rest }: Props
secondaryText secondaryText
)} )}
</Stack> </Stack>
) );
} })()}
sx={sx} sx={sx}
/> />
); );