  Ab-initio calculations for the electronic and optical properties of
single-layer (SL) tungsten disulfide (WS$_2$) in the presence of substitutional
Erbium defects (Er$_{\rm W}$) are presented, where the W atom is replaced by an
Er atom. Defects usually play an important role in tailoring electronic and
optical properties of semiconductors. We show that neutral Er defects lead to
localized defect states (LDS) in the band structure due to the f-orbital states
of Er, which in turn give rise to sharp transitions in in-plane and
out-of-plane optical absorption spectra, $\alpha_{\parallel}$ and
$\alpha_{\perp}$. We identify the optical transitions at 3 $\mu$m, 1.5 $\mu$m,
1.2 $\mu$m, 920 nm, 780 nm, 660 nm, and 550 nm to originate from Er$_{\rm W}$
defect states. In order to provide a clear description of the optical
absorption spectra, we use group theory to derive the optical selection rules
between LDS for both $\alpha_{\parallel}$ and $\alpha_{\perp}$.
