diff --git a/packages/mui-base/src/Checkbox/CheckboxIndicator.tsx b/packages/mui-base/src/Checkbox/CheckboxIndicator.tsx index 6e409c6620..41d06bbb5e 100644 --- a/packages/mui-base/src/Checkbox/CheckboxIndicator.tsx +++ b/packages/mui-base/src/Checkbox/CheckboxIndicator.tsx @@ -5,6 +5,7 @@ import { CheckboxContext } from './CheckboxContext'; import { resolveClassName } from '../utils/resolveClassName'; import { useCheckboxStyleHooks } from './utils'; import { evaluateRenderProp } from '../utils/evaluateRenderProp'; +import { useExtendedForkRef } from '../utils/useExtendedForkRef'; function defaultRender(props: React.ComponentPropsWithRef<'span'>) { return ; @@ -34,6 +35,7 @@ const CheckboxIndicator = React.forwardRef(function CheckboxIndicator( } const styleHooks = useCheckboxStyleHooks(ownerState); + const mergedRef = useExtendedForkRef(render, forwardedRef); if (!keepMounted && !ownerState.checked && !ownerState.indeterminate) { return null; @@ -41,7 +43,7 @@ const CheckboxIndicator = React.forwardRef(function CheckboxIndicator( const elementProps = { className: resolveClassName(className, ownerState), - ref: forwardedRef, + ref: mergedRef, ...styleHooks, ...otherProps, }; diff --git a/packages/mui-base/src/Checkbox/CheckboxRoot.tsx b/packages/mui-base/src/Checkbox/CheckboxRoot.tsx index 1662433376..6f58c30fa9 100644 --- a/packages/mui-base/src/Checkbox/CheckboxRoot.tsx +++ b/packages/mui-base/src/Checkbox/CheckboxRoot.tsx @@ -6,6 +6,7 @@ import { CheckboxContext } from './CheckboxContext'; import { useCheckbox } from '../useCheckbox'; import { useCheckboxStyleHooks } from './utils'; import { evaluateRenderProp } from '../utils/evaluateRenderProp'; +import { useExtendedForkRef } from '../utils/useExtendedForkRef'; function defaultRender(props: React.ComponentPropsWithRef<'button'>) { return