قُولِي السَّلاَمُ عَلَى أَهْلِ الدِّيَارِ مِنَ الْمُؤْمِنِينَ وَالْمُسْلِمِينَ وَيَرْحَمُ اللَّهُ الْمُسْتَقْدِمِينَ مِنَّا وَالْمُسْتَأْخِرِينَ وَإِنَّا إِنْ شَاءَ اللَّهُ بِكُمْ لَلاَحِقُونَ
Translation: "Peace be upon the inhabitants of this abode from among the Believers and the Muslims, and may Allah have mercy on those who have gone ahead of us, and those who come later on, and we shall, God willing, join you."
(Sahih Muslim)
As with all things, there are boundaries that we must stay within, as defined by the Shari'ah. Visiting the grave is an action that requires composure and solemnity. One should avoid excessive crying and wailing, which the Prophet ﷺ forbade.