Graphene nanoribbons (GNRs) are ultra-narrow strips of graphene that have the potential to be used in high-performance graphene-based semiconductor electronics. However, controlled growth of GNRs on dielectric substrates remains a challenge. Here, we report the successful growth of GNRs directly on hexagonal boron nitride substrates with smooth edges and controllable widths using chemical vapour deposition. The approach is based on a type of template growth that allows for the in-plane epitaxy of mono-layered GNRs in nano-trenches on hexagonal boron nitride with edges following a zigzag direction. The embedded GNR channels show excellent electronic properties, even at room temperature. Such in-plane hetero-integration of GNRs, which is compatible with integrated circuit processing, creates a gapped channel with a width of a few benzene rings, enabling the development of digital integrated circuitry based on GNRs.