The active part of the mixing valve, the element, expands and contracts in response to changes in the temperatures and pressures of the incoming hot and cold water supplies.
As the element expands and contracts, it moves the slide valve to correctly proportion the amount of cold and hot water entering the valve. If the cold water supply were to fail slowly over a long period of time, the valve would increasingly throttle the hot supply to maintain a safe temperature at the outlet. On total failure of the cold water supply, the thermostat element would expand fully and move the slide valve to shut down on the hot supply so that scalding water cannot reach the outlet.
(please note the adjacent video does not have voiceover)