Polaritonic states, which are formed by resonances between a molecular excitation and the photonic mode of a cavity, have a number of useful properties that offer new routes to control molecular photochemistry using electric fields. To provide a theoretical description of how polaritonic states affect the real-time electron dynamics in molecules, a new method is described where the effects of strong light–molecule coupling are implemented using real-time electronic structure theory. The coupling between the molecular electronic states and the cavity is described by the Pauli–Fierz Hamiltonian, and transitions between polaritonic states are induced via an external time-dependent electric field using time-dependent configuration interaction (TDCI) theory, producing quantum electrodynamics TDCI (QED-TDCI). This method is used to study laser-induced ultrafast charge transfer and dipole-switching dynamics of the LiCN molecule inside a cavity. The increase in cavity coupling strength is found to have a significant impact on the energies and transition dipole moments of the molecule–cavity system. The convergence of the polaritonic state energies as a function of the number of included electronic and photonic basis states is discussed.