Bulk MoS${}_{2}$, a prototypical layered transition-metal dichalcogenide, is an indirect band gap semiconductor. Reducing its slab thickness to a monolayer, MoS${}_{2}$ undergoes a transition to the direct band semiconductor. We support this experimental observation by first-principle calculations and show that quantum confinement in layered $d$-electron dichalcogenides results in tuning the electronic structure. We further studied the properties of related $T$S${}_{2}$ nanolayers ($T=$ W, Nb, Re) and show that the isotopological WS${}_{2}$ exhibits similar electronic properties, while NbS${}_{2}$ and ReS${}_{2}$ remain metallic independent of the slab thickness.