The area, or as originally written, length and width*, are but two of many parameters that define the flaps and slats.
The final parameters are a result of an iterative process, as shown above. You try a set of parameters, if they don't work, you go back one step, or even two steps (redesigning the wing).
For example when the A320 was stretched to become the A321, the extra weight meant a change to the flaps was needed. If that had failed, they would have changed the wing or part of it (like they did with the A350-1000).
The basic initial design goal is to work out the parameters that achieve the condition below. The parameters on the right-hand side are a given at this point in the design.
$C_L$ is the lift coefficient. $f$ and $s$ denote flaps and slats. The different parameters, including the deflection angle and type of high-lift device used, define the $\Delta C_L$. $\Delta$ (delta) is the increase from the clean wing state brought about by the slats/flaps.
If the design choices don't work, you try something else. In the A321 the double-slotted flaps worked. In the A350-1000 they had to redesign the wing.
Below you see with the lack of inboard ailerons (decided in step 7), the span of the flaps is defined. If the ailerons are too narrow, you risk aileron reversal. If there were inboard high-speed ailerons, that flap area would then be divided further. Generally the slats cover more span than the flaps.
The spanwise reach of slats and flaps has to be established, as must the flap type and the angle of deflection of slats and flaps. As already mentioned, it will not generally be possible to set the parameters without an iterative approach.
* The terms chord and span are better and less confusing.
Source: Hamburg Open Online University (.pdf).
For a paper on the Airbus A380 wing and flaps design, see: Aerodynamic Design of Airbus High-Lift Wings in a Multidisciplinary Environment.