I'm not sure about all but definitely most 10 and 11 speed. Just make sure the shifters and the mech are both Exact Actuation.
The shifters dictate the number of gears. You can use a 10s rear mech as an 11s set up if the shifters are 11s. Match cassette to shifters.
Sram 10 speed with MTB rear mech
Unless you want hydro brakes
In which case no