In MRI, we have large homogenous field $\vec B_0 =B_0 \hat z$ always present, $\hat z$ being a unit vector in $z$ direction. This field is huge compared to the gradient fields which is why we are only interested in the change of the $z$ component of the total field. The word gradient actually refers to the gradient of this particular field component, i.e., $\nabla B_z$.
To achieve a gradient of $B_z$ in $z$ direction, one can use a simply a Helmholtz coil pair or a Maxwell coil. For the trasverse gradient (in $x$ or $y$ direction), one has to choose another type of coil, called Golay coil. You can find the coil geometries by googling.
Because static magnetic fields are curl-free in free space, having gradient in of $z$ component, the field must also a gradient of another component. Since the $B_0$ field dominates the field direction and magnitude, we can always neglect these so called concomitant components.