We consider Carroll-invariant limits of Lorentz-invariant field theories. We show that just as in the case of electromagnetism, there are two inequivalent limits, one electric and the other magnetic. Each can be obtained from the corresponding Lorentz-invariant theory written in Hamiltonian form through the same contraction procedure of taking the ultrarelativistic limit $c rightarrow 0$ where $c$ is the speed of light, but with two different consistent rescalings of the canonical variables. This procedure can be applied to general Lorentz-invariant theories ($p$-form gauge fields, higher spin free theories etc) and has the advantage of providing explicitly an action principle from which the electrically-contracted or magnetically-contracted dynamics follow (and not just the equations of motion). Even though not manifestly so, this Hamiltonian action principle is shown to be Carroll invariant. In the case of $p$-forms, we construct explicitly an equivalent manifestly Carroll-invariant action principle for each Carroll contraction. While the manifestly covariant variational description of the electric contraction is rather direct, the one for the magnetic contraction is more subtle and involves an additional pure gauge field, whose elimination modifies the Carroll transformations of the fields. We also treat gravity, which constitutes one of the main motivations of our study, and for which we provide the two different contractions in Hamiltonian form.