The electromechanical function of the heart involves complex, coordinated activity over time and space. Life-threatening cardiac arrhythmias arise from asynchrony in these space-time events; therefore, therapies for prevention and treatment require fundamental understanding and the ability to visualize, perturb and control cardiac activity. Optogenetics combines optical and molecular biology (genetic) approaches for light-enabled sensing and actuation of electrical activity with unprecedented spatiotemporal resolution and parallelism. The year 2020 marks a decade of developments in cardiac optogenetics since this technology was adopted from neuroscience and applied to the heart. In this Review, we appraise a decade of advances that define near-term (immediate) translation based on all-optical electrophysiology, including high-throughput screening, cardiotoxicity testing and personalized medicine assays, and long-term (aspirational) prospects for clinical translation of cardiac optogenetics, including new optical therapies for rhythm control. The main translational opportunities and challenges for optogenetics to be fully embraced in cardiology are also discussed.