Preheat the oven to 350°F. Line two 12-cup muffin pans with paper liners.
In a medium bowl, whisk together the flour, baking powder, and salt.
In a large bowl or the bowl of a stand mixer with the paddle attachment, beat the sugar and butter on medium speed until light and fluffy, about 3 minutes. Beat in the vanilla. Add the eggs one at a time, and beat until well combined before adding the next. Stop and scrape down the bowl as needed.
With the mixer on low speed, add in the flour mixture alternating with the coconut milk. Scrape down the bowl and stir in the coconut. Fill the cupcake papers about three-quarters full.
Bake for 20 to 23 minutes or until a wooden pick inserted into the center of a cupcake comes out clean. Cool the cupcakes in the pan for a few minutes, then remove and cool completely on a wire rack before frosting.
For the Frosting:
In a large mixing bowl or the bowl of a stand mixer with the paddle attachment, beat the butter and cream cheese on medium speed until smooth. With the mixer on low speed, gradually mix in the powdered sugar until combined. Add the vanilla and coconut milk and beat on medium-low speed until fluffy, about 1 minute.
Transfer the frosting to a piping bag fitted with a decorative tip and pipe onto the cupcakes. Sprinkle coconut on top of each cupcake. Cupcakes can be stored for up to 3 days in an airtight container at room temperature.
Video
Notes
Avoid overmixing as you risk over-developing the gluten in the batter leading to tough and dense coconut cupcakes.
Measure your flour correctly! Adding too much flour to the recipe is the most common mistake that will yield dry and dense cupcakes. The best and easiest way to measure flour is by using a scale. If you don't have one, then fluff your flour with a spoon, sprinkle it into your measuring cup, and use a knife to level it off.
The eggs should be at room temperature to incorporate evenly into your batter. If you forgot to take your eggs out of the fridge ahead of time, you could quickly bring them to room temperature by placing them in a large bowl and covering them with warm tap water for 5 minutes.
Sift the flour if there are any lumps. Sift the powdered sugar as well for a smooth frosting.
If the coconut milk has separated in the can, stir it back together before adding it to the batter.
To add extra flavor and a crunchy texture to contrast the soft cupcake crumb, you can toast the shredded coconut before sprinkling it on top of the frosting.
Using an ice cream scoop helps distribute the batter into the cupcake liners uniformly.
If you only have one muffin pan, you can bake the cupcakes in batches.