This super-simple dimmer consists of only two components, and it can easily be built into a mains switch. If you do this, don’t forget to first switch off the associated branch circuit in the fuse box, since the mains voltage is always dangerous! The circuit does not need much explanation.
When S1 is closed, the lamp works at full strength, and the position of S2 does not matter. When S1 is open and S2 is closed, the capacitor causes a voltage drop, so the lamp is dimmed. The power dissipation of the capacitor is practically zero, so the circuit does not generate any heat.
The resistor prevents sparking when S2 is closed while S1 is already closed. The value of the capacitor can be matched to the power of the lamp to be dimmed; it should be between 2 and 6 µF. Be sure to use a class X2 capacitor. Also, don’t forget that this circuit works only with resistive (non-inductive) loads. Unpredictable things can happen with an inductive load!