Praise be to Allah.
It is a good thing for the Muslim to be concerned about Islamic rulings, even concerning the smallest of details. Even more important than being concerned about them is to act upon what ones knows of those rulings. With regard to kunyahs there are some issues that are worth pointing out, after which we will answer the question itself, with further details.
The kunyah is a name that beings with “Abu (Father of)” or “Umm (Mother of)”; it is something other than a personal name or a nickname.
The kunyah is something with which a person is praised and honoured, unlike nicknames which may have connotations of praise or otherwise.
Evildoers, disbelievers and innovators may be referred to by kunyahs if they are only known by their kunyahs, or if that is done for a purpose, or if their names contain meanings that are contrary to Islam.
Allah, may He be exalted, says (interpretation of the meaning): “Perish the two hands of Abu Lahab (an uncle of the Prophet), and perish he!” [al-Masad 111:1].
An-Nawawi (may Allah have mercy on him) said: Chapter on the permissibility of giving a kunyah to a disbeliever, innovator or evildoer, if he is only known by that name or there is the fear that mentioning his real name may cause confusion. Allah, may He be exalted, says (interpretation of the meaning): “Perish the two hands of Abu Lahab (an uncle of the Prophet), and perish he!” [al-Masad 111:1], although his actual name was ‘Abd al-‘Uzza. It was said that he was mentioned by his kunyah because he was known by it, or it was said that this was so as to avoid using his name, as it described him as a slave of an idol (al-‘Uzza).
I [Imam an-Nawawi (may Allah have mercy on him) is speaking] say: Abu Taalib is repeatedly mentioned in hadeeth by his kunyah, and his name was ‘Abd Manaaf. In as-Saheeh it says: “This is the grave of Abu Righaal.” And there are many similar examples. All of this applies if the condition that we have mentioned above is met. If it is not met, nothing to the name should be used.
End quote from al-Adhkaar, p. 296
The kunyah does not necessarily have to include the name of one’s child; rather it may refer to an inanimate object or an animal.
Examples of kunyahs referring to inanimate objects include “Abu Turaab (i.e., the one who has dust on him); examples of kunyahs referring to animals include “Abu Hirr” or “Abu Hurayrah” (i.e., the one who has a cat or kitten, respectively).
Kunyahs referring to names do not necessarily have to refer to one of the children of the individual who is called by that kunyah.
For example, Abu Bakr as-Siddeeq did not have a son whose name was Bakr.
The kunyah does not have to refer to the oldest child of the person who is called by that kunyah, although that is preferable.
It was narrated from Haani’ that when he came to the Messenger of Allah (blessings and peace of Allah be upon him) with his people, he heard them calling him by the kunyah Abu’l-Hakam. The Messenger of Allah (blessings and peace of Allah be upon him) summoned him and said: “Allaah is al-Hakam (the Judge), and judgement belongs to Him. Why are you known by the kunyah of Abu’l-Hakam?” He said: When my people differ concerning anything, they come to me and I pass judgement among them, and both sides accept it. The Messenger of Allaah (blessings and peace of Allah be upon him) said: “How good this is. Do you have any children? He said: I have Shurayh, Muslim and ‘Abd-Allaah. He said: “Who is the oldest of them?” I said: Shurayh. He said: “Then you are Abu Shurayh.”
Narrated by Abu Dawood, 4955; an-Nasaa’i, 5387; classed as saheeh by al-Albaani in Saheeh Abi Dawood.
The scholars of the Standing Committee were asked: Is it permissible to call someone by referring to his younger son, because the older son died in infancy?
They replied: It is preferable to call a person by referring to his oldest son, whether he is alive or dead, and to call him by that kunyah. But if a person is called by referring to his youngest son, there is no sin on the one who does that, whether the older son is alive or dead.
And Allah is the source of strength. May Allah send blessings and peace upon our Prophet Muhammad and his family and companions. End quote.
Shaykh ‘Abd al-‘Azeez ibn Baaz, Shaykh ‘Abd ar-Razzaaq ‘Afeefi, Shaykh ‘Abdullah ibn Qa‘ood
Fataawa al-Lajnah ad-Daa’imah, 11/487
There is no reason why the kunyah cannot refer to the daughters of the person who is called by that kunyah.
An-Nawawi (may Allah have mercy on him) said: Chapter on the permissibility of a man being called by a kunyah referring to either a male or a female, or a woman being called by a kunyah referring to a either a male or a female. It should noted that there is no restriction in this matter. Some of the best of the earliest generations of this ummah -- the Sahaabah and the Taabi‘een who came after them -- were known by kunyahs referring to their daughters, such as ‘Uthmaan ibn ‘Affaan (may Allah be pleased with him) who had three kunyahs: Abu ‘Amr, Abu ‘Abdullah, and Abu Layla. There was also Abu’d-Darda’ and his wife Umm ad-Darda’ al-Kubra… End quote.
Al-Adhkaar, p. 296
The rulings mentioned above apply equally to men and women.
The person who has a kunyah may be someone who does not have any children; this does not mean that he cannot be called by a kunyah.
It was narrated from ‘Aa’ishah that she said: O Messenger of Allah, all my friends have a kunyah except me. He said: “Take a kunyah from the name of your son (nephew) ‘Abdullah ibn az-Zubayr.” So she was called Umm ‘Abdullah until she died.
Narrated by Ahmad, 43/291. Classed as saheeh by the editors of al-Musnad and by al-Albaani in as-Silsilah as-Saheehah, 132.
A man or a woman may be given a kunyah after marriage and before having a child; there is nothing wrong with that.
It was narrated from ‘Abdullah ibn Mas‘ood (may Allah be pleased with him) that the Messenger of Allah (sa) gave him the kunyah Abu ‘Abd ar-Rahmaan when he had not had a child.
Narrated by al-Haakim, 3/353; at-Tabaraani in al-Kabeer, 9/65; classed as saheeh by Ibn Hajar in Fath al-Baari, 10/582
al-Bukhaari narrated in al-Adab al-Mufrad, under the heading Chapter on giving a kunyah before one has a child: It was narrated from Ibraaheem an-Nakha‘i that ‘Abdullah ibn Mas‘ood was given the kunyah Abu Shibl when he did not have a child.
Classed as saheeh by al-Albaani in Saheeh al-Adab al-Mufrad, 848.
There is no impediment to giving a child a kunyah, even before weaning or at the time of birth, whether the child is male or female. The scholars mentioned several benefits of giving a kunyah to a child, such as: strengthening his character and avoiding bad nicknames; it is also a sign of optimism that he will live to adulthood and have children of his own.
Giving kunyahs to children is an established part of the Sunnah and was narrated from the Prophet (blessings and peace of Allah be upon him).
It was narrated that Anas ibn Maalik (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) was the best of people in attitude. I had a brother who was called Abu ‘Umayr -- I think he was weaned. When the Messenger of Allah (blessings and peace of Allah be upon him) saw him he said: “Abu ‘Umayr, what happened to (your pet) bird?” He used to play with the bird.
Narrated by al-Bukhaari, 5850; Muslim, 2150.
Al-Bukhaari included this hadeeth in a chapter entitled: Kunyahs for children, and before a man has a child.
An-Nawawi (may Allah have mercy on him) said: We learn many things from this hadeeth, such as the permissibility of giving a kunyah to someone who has no children and giving a kunyah to a child; it is not regarded as lying.
End quote from Sharh Muslim 14/129
In al-Mawsoo‘ah al-Fiqhiyyah (35/170, 171), it says: The scholars said: They used to give kunyahs to children as a sign of optimism that the child would live until he grew up and had a child, and so as to avoid nicknames.
Ibn ‘Aabideen said: If a person gives his small child the kunyah of Abu Bakr and so on, some of the scholars regarded that as makrooh, but the majority did not regard it as makrooh, because people intend optimism by doing that.
Thus the answer to the question itself is that it is permissible to give appropriate kunyahs to children, both male and female, even if they are still breastfeeding. If they are given the kunyahs of some of the Sahaabah, male or female, this is something good and is not objectionable.
And Allah knows best.