diff --git a/packages/components/src/unit-control/index.tsx b/packages/components/src/unit-control/index.tsx index 8b5028970026cb..14092ad8996252 100644 --- a/packages/components/src/unit-control/index.tsx +++ b/packages/components/src/unit-control/index.tsx @@ -36,7 +36,14 @@ import type { UnitControlProps, UnitControlOnChangeCallback } from './types'; import type { StateReducer } from '../input-control/reducer/state'; function UnforwardedUnitControl( - { + unitControlProps: WordPressComponentProps< + UnitControlProps, + 'input', + false + >, + forwardedRef: ForwardedRef< any > +) { + const { __unstableStateReducer: stateReducerProp, autoComplete = 'off', className, @@ -54,10 +61,9 @@ function UnforwardedUnitControl( units: unitsProp = CSS_UNITS, value: valueProp, ...props - }: WordPressComponentProps< UnitControlProps, 'input', false >, - forwardedRef: ForwardedRef< any > -) { - if ( typeof unitProp !== 'undefined' ) { + } = unitControlProps; + + if ( 'unit' in unitControlProps ) { deprecated( 'UnitControl unit prop', { since: '5.6', hint: 'The unit should be provided within the `value` prop.',