The richness of optical and electronic properties of graphene attracts enormous interest. Graphene has high mobility and optical transparency, in addition to flexibility, robustness and environmental stability. So far, the main focus has been on fundamental physics and electronic devices. However, we believe its true potential lies in photonics and optoelectronics, where the combination of its unique optical and electronic properties can be fully exploited, even in the absence of a bandgap, and the linear dispersion of the Dirac electrons enables ultrawideband tunability. The rise of graphene in photonics and optoelectronics is shown by several recent results, ranging from solar cells and light-emitting devices to touch screens, photodetectors and ultrafast lasers. Here we review the state-of-the-art in this emerging field.