We study the structural, optical, and electrical properties of MgzY1-z swit
chable mirrors upon hydrogenation. It is found that the alloys disproportio
nate into essentially pure YH3-delta and MgH2 with the crystal structure of
YH3-delta dependent on the Mg concentration z. For 0<z<0.1, both hcp and f
ee YH3-delta are observed, whereas for z greater than or equal to 0.1 only
cubic YH3-delta is present. Interestingly, cubic YH3-delta is expanded comp
ared to YH2, in disagreement with theoretical predictions. From optical and
electrical measurements we conclude that cubic YH3-delta is a transparent
insulator with properties similar to hexagonal YH3-delta Our results are in
consistent with calculations predicting fee YH3-delta to be metallic, but t
hey are in good agreement with recent GW calculations on both hcp and fee Y
H3. Finally, we find an increase in the effective band gap of the hydrided
MgzY1-z alloys with increasing z. Possibly this is due to quantum confineme
nt effects in the small YH3 clusters.