Ultra-slim Photoelectric Sensor EX-10 (Panasonic)

Smallest body, just 3.5 mm 0.138 in thick

It can be mounted in a very small space as its size is just
W10 x H14.5 x D3.5 mm
W0.394 x H0.571 x D0.138 in (thru-beam, front sensing type).