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