Charmonia are key probes to study nuclear matter in extreme conditions, like the quark--gluon plasma formed in heavy-ion collisions. At LHC energies, the regeneration process due to the abundantly produced charm quarks was found to considerably affect measured charmonium observables. Comprehensive measurements of charmonia, including both ground and excited states, are crucial to discriminate among different regeneration scenarios assumed in theoretical calculations. Charmonia can also be sensitive to the initial states of the heavy-ion collisions. In particular, their spin-alignments can be affected by the strong magnetic field generated in the early phase, as well as by the large angular momentum of the medium in non-central collisions. The determination of the component originating from beauty-hadron decays, known as non-prompt charmonium, grants a direct insight into the nuclear modification factor of beauty hadrons, which is expected to be sensitive to the energy loss experienced by the ancestor beauty quarks inside the QGP. Furthermore, once it is subtracted from the inclusive charmonium production, it allows a direct access to prompt charmonia.
In this contribution, recent ALICE results on charmonium production are reported. Inclusive J/$\psi$ nuclear modification factors, obtained at mid and forward rapidity in Pb--Pb collisions at $\sqrt{s_{\rm NN}}$ = 5.02 TeV, are discussed. Also, prompt and non-prompt J/$\psi$ nuclear modification factors at midrapidity are presented. Results from $\psi$(2S) nuclear modification factor and J/$\psi$
polarization with respect to a quantization axis orthogonal to the event-plane obtained at forward rapidity in Pb--Pb collisions at $\sqrt{s_{\rm NN}}$ = 5.02 TeV, are also described. Results are compared to available model calculations.