"If your keyboard is external, you should disconnect it from your Mac immediately. If it has batteries in it, remove them. Mop, rather than wipe up any residual liquid, preferably using a microfiber cloth. Hold the keyboard upside down to allow the liquid to run out.
What you do next depends on what was spilled and how much liquid there was. For water or anything else that has no sugar in it, you may be able to give the surface a quick rinse with clean water and let it dry out. For larger spills, you might need to open the keyboard up with a screwdriver and mop the components individually."