Right-click with a block to load it onto the cart. Shift + right-click to use it. Right-click while leading an animal to put it in the cart. Shift + right-click to let it out.