Why does salt have a texture?

Because it is made of tiny crystals in the shape of cubes.

Sodium chloride crystal structure

Salt is made of sodium and chlorine. Chlorine atoms are a little bigger than sodium atoms. Chlorine is 181 picometers in radius, and sodium is only 102 picometers. They have opposite charges, so they pack as closely as they can, given their different sizes. That turns out to be the shape of a cube.

The salt in your salt shaker may have been ground up from larger crystals, so many of the crystals may be broken, especially if you have a salt grinder instead of a salt shaker. But many salt companies crystallize their salt to purify it, and arrange the conditions of the crystallization so that perfectly sized little cubes are formed.

You can use a magnifying glass or a microscope to see the tiny cube shapes. Or you can dissolve as much salt as you can in boiling water, and let some of it slowly evaporate in a glass dish. If the evaporation rate is slow (because you let the solution cool in the refrigerator) you will get larger cubes, which you can see without a magnifying glass.