First-principle studies on the total energy, electronic structure, and bonding nature of $R\mathrm{NiIn}$ $(R=\mathrm{La},$ Ce, and Nd), and their saturated hydrides ${(R}_{3}{\mathrm{Ni}}_{3}{\mathrm{In}}_{3}{\mathrm{H}}_{4}=R{\mathrm{NiInH}}_{1.333})$ are performed using a full-potential linear muffin-tin orbital approach. This series of phases crystallizes in a ZrNiAl-type structural frame-work. When hydrogen is introduced in the $R\mathrm{NiIn}$ matrix, anisotropic lattice expansion is observed along [001] and lattice contraction along [100]. In order to establish the equilibrium structural parameters for these compounds we have performed force minimization as well as volume and $c/a$ optimization. The optimized atomic positions, cell volume, and $c/a$ ratio are in very good agreement with recent experimental findings. From the electronic structure and charge density, charge difference, and electron localization function analyses the microscopic origin of the anisotropic change in lattice parameters on hydrogenation of $R\mathrm{NiIn}$ has been identified. The hydrides concerned, with their theoretically calculated interatomic H-H distances of \ensuremath{\sim}1.57 \AA{}, violate the ``2-\AA{} rule'' for H-H separation in metal hydrides. The shortest internuclear Ni-H separation is almost equal to the sum of the covalent radii. H is bonded to Ni in an H-Ni-H dumbbell-shaped linear array, with a character of ${\mathrm{NiH}}_{2}$ subunits. Density of states, valence charge density, charge transfer plot, and electron localization function analyses clearly indicate significant ionic bonding between Ni and H and weak metallic bonding between H-H. The paired and localized electron distribution at the H site is polarized toward La and In which reduces the repulsive interaction between negatively charged H atoms. This could explain the unusually short H-H separation in these materials. The calculations show that all these materials have a metallic character.