Greetings. My explanation is based on the Abhidhamma, and I cannot say at the moment if there are suttas that elucidate this issue in the same detailed way as presented in the Abhidhamma.
Material objects are said to be composed of kalapas, the smallest constituent units of matter (an “atom,” but not in the sense used by modern science). Kalapas are formed by the four great elements (Māhabhūta), which do not exist separately but arise and cease together. The earth element represents the property of matter that generates the sensation of solidity (hardness or softness) when coming into contact with the tactile sense organs.
In addition to the earth element, fire represents heat/cold, air represents motion/resistance, and water represents cohesion/fluidity of material components. The properties of fire and air can also be accessed through the sense of touch. However, the property of water does not have its own distinct sensory impression; it is inferred by the mind through the sensations derived from the other elements.