Aims. With the recent launch of the IRIS mission, it has become urgent to develop the spectral diagnostics using the Mg ii resonance h and k lines. In this paper, we aim to demonstrate the behavior of these lines under various prominence conditions. Our results serve as a basis for analysis of new IRIS data and for more sophisticated prominence modeling. Methods. For this exploratory work, we use a canonical 1D prominence-slab model, which is isobaric and may have three different temperature structures: isothermal, PCTR-like (prominence-corona transition region), and consistent with the radiative equilibrium. The slabs are illuminated by a realistic incident solar radiation obtained from the UV observations. A five-level plus continuumMg ii model atom is used to solve the full NLTE problem of the radiative transfer. We use the numerical code based on the ALI techniques and apply the partial frequency redistribution for both Mg ii resonance lines. We also use the velocity-dependent boundary conditions to study the effect of Doppler dimming in the case of moving prominences. Finally, the relaxation technique is used to compute a grid of models in radiative equilibrium.Results. We computed the Mg ii h and k line profiles that are emergent from prominence-slab models and show their dependence on kinetic temperature, gas pressure, geometrical extension, and microturbulent velocity. By increasing the line opacity, significant departures from the complete frequency redistribution take place in the line wings. Models with a PCTR temperature structure show that Mg ii becomes ionized to Mg iii in the temperature range between roughly 15 000 and 30 000 K. Doppler dimming is significant for Mg ii resonance lines. At the velocity 300 km s −1 , the line intensity decreases to about 20% of the value for static prominences.Finally, we demonstrate the role of Mg ii h and k radiation losses on the prominence energy balance. Their dominant role is at lower pressures, while the losses due to hydrogen and Ca ii dominate at higher pressures.