This paper develops a gravity model with sector-level input-output linkages in production. In contrast to a traditional gravity approach, which relies on direct gross exports between bilateral trade partners, our model additionally includes (1) domestic and global value chain linkages between goods and services sectors, (2) bilateral tariffs that affect direct production for a final destination as well as indirect production (shipped via third countries) to a final destination and (3) value added rather than gross production. Including input-output linkages implies that domestic production of intermediates can serve as inputs in foreign products and subsequently be exported indirectly to a final destination. Our input-output model can be taken to the sectoral World Input Output Database (WIOD) and can be used to evaluate trade policy shocks. While our framework is entirely general, we use it to predict the impact of the UK's withdrawal from the European Union (Brexit) in terms of value added production and employment for every individual EU country involved. We find that Brexit hits the UK relatively harder than the EU-27. In contrast to other studies, we find EU-27 losses from Brexit to be substantially higher than hitherto believed.