Cardinal Virtues operate under Theological Virtues, and the Gifts of the Holy Spirit perfect cardinal and theological virtues.
Virtues and Gifts of the Holy Spirit are fundamental to salvation. The Theological Virtues perfect human faculties, and the Gifts of the Holy Spirit perfect cardinal and theological virtues. Each gift perfects one or more cardinal and theological virtues, such as Knowledge operates on Faith and Fear of the Lord on Temperance.
Grace enhances cardinal and theological virtues, and the gifts operate under the Holy Spirit’s guidance. The virtues operate under human mode and the gifts under spiritual mode, so virtues can operate when you wish, but gifts operate only when the Holy Spirit wishes. The soul exercises the virtues and is passive under the influence of the gifts, unless they require the cooperation of the intellect and the will.
The Rev. Brian Shanley, OP, contrasts the gifts to the virtues.
“What the gifts do over and above the theological virtues (which they presuppose) is dispose the agent to the special promptings of the Holy Spirit in actively exercising the life of the virtues; the gifts are necessary for the perfect operations of the virtues, especially in the face of our human weakness and in difficult situations.”