The "transit method" means doing very careful precise measurements as the planet passes in front of its star.
It's too far away for us to see it directly, but when it "transits" the star, the brightness of the star decreases by a tiny tiny tiny bit, which we can measure.
If we can measure that dip with good enough precision, it tells us how much of the star's photosphere was blocked from our view when the planet temporarily got in the way. From that, we can estimate the planet's size.