Models of the early stages of basaltic eruptions beneath temperate glaciers are presented that consider the evolving sizes of volcanic edifices emplaced within subglacial cavities. The cavity size reflects the competing effects of enlargement by melting and closure by downward ductile deformation of the ice roof, which occurs when the cavity pressure is less than glaciostatic due to meltwater drainage. Eruptions of basaltic magma from fissures and point sources are considered, which form either hemicylindrical or hemispherical cavities. The rate of roof closure can therefore be estimated using Nye's law. The cavity size, edifice size, and depth of meltwater above the edifice are predicted by the model and are used to identify two potential eruption mechanisms: explosive and intrusive. When the cavity is considerably larger than the edifice, hydroclastic fragmentation is possible via explosive eruptions, with deposition of tephra by eruption-fed aqueous density currents. When the edifice completely fills the cavity, rising magma is likely to quench within waterlogged tephra in a predominantly intrusive manner. The models were run for a range of magma discharge rates, ice thicknesses and cavity pressures relevant to subglacial volcanism in Iceland. Explosive eruptions occur at high magma discharge rates, when there is insufficient time for significant roof closure. The models correctly predict the style of historic and Pleistocene subglacial fissure eruptions in Iceland and are used to explain the contrasting sedimentology of basaltic and rhyolitic tuyas. The models also point to new ways of unraveling the complex coupling between eruption mechanisms and glacier response during subglacial eruptions.