Now, since the notebook still is under warranty I presume we are talking about a recent notebook.
The keyboard, in modern notebooks, is usually one part with the top cover. So to replace officially you would need to buy the complete top cover and then all the parts from the old notebook need to be removed from the old top cover and placed in the new one. So, if done officially it will most likely cost about the price of a new notebook.
You could try your nearest HP service center and see what they say.
Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".