A first-principles study of the structural, electrical, and optical properties of graphene-like two-dimensional (2D) materials ABX (A = Na/K, B = C/Si/Ge, and X = N/P/As) such as NaCN, KCN, NaCP, KCP, etc. was undertaken using state-of-the-art Density Functional Theory (DFT). The investigation encompasses essential parameters such as structural stability through ab initio molecular dynamics (AIMD), electronic structure, and dielectric constants. The AIMD measurements reveal that the structures stay stable for up to 10 picoseconds (ps). Band structure calculations at the PBE level of theory revealed that most materials are semi-conducting with a band gap of 1-3 eV, except NaCN and KCN, which exhibited insulating behaviour. Using hybrid functional (HSE), only eight materials were identified to have a band gap in the visible range. Optical properties have also been investigated to understand their interaction with light. Peaks in the imaginary component of the dielectric function were attributed to inter-band transitions. Several materials were discovered to be optimal for photo-catalysis, while six were found to exhibit conductivity of the order of $\sim 10^{12}$ ($\Omega^{-1}cm^{-1} s^{-1}$) at room temperature.