Encoder to replace a potentiometer

I have a UNO R3 with a Motor Shield and a potentiometer to run power to a model railway track, I am wondering if I can replace the potentiometer with an clickable push on/off encoder.
What kind of encode would work for me?

It would be an absolute encoder, unless starting position is irrelevant

The KY040 type is popular. Used in conjunction with the Encoder library or equivalent. You can treat the push switch like any other momentary switch or some encoder libraries include functions to read the switch.

Thank you both - I have ordered the KY040 .