SMPS Input/Output ripple current and ripple voltage
I dont understand how a capacitor can filter high peak currents


The input capacitor provides an unambiguous source of energy during the switching cycle. The level of energy required by the switching circuit can be high over a short period of time and, this can collapse the external input power supply if a capacitor is not used. When that "instantaneous" energy is not being used, the capacitor becomes more leisurely recharged and is ready for the next short-term delivery of energy.

That capacitor also ensures that the bulk of the current flow (when the high energy is required) is contained within the loop as shown below in green lines: -



This minimizes EMI along the feed lines from the input power source (far left)


  Why do we need to
  keep the loop area small?


If you look at the loop above (green wires) you can regard it as an emitter of magnetic fields; the current is sourced from the input capacitor and, in part, dumped into the output capacitor. In effect it's a loop antenna that is made better by doing this: -




  Why do we need short traces at switching nodes


The switching node has capacitance to everything in the local vicinity. It has a voltage that pulses up and down at a fast rate hence it can couple surges (another form of EMI) to sensitive nodes in the local vicinity. To minimize that EMI we keep that node as short as possible in order to reduce that capacitive coupling to sensitive nodes.