Beat the softened butter on medium speed for 2 to 3 minutes until pale, creamy, and noticeably fluffy.
Sift the cocoa powder and 2 cups of the powdered sugar over the butter. Mix on the lowest speed until combined, then beat on medium for 1 minute.
Pour in the milk or cream, vanilla, and salt, then add the remaining powdered sugar one cup at a time, beating on low after each addition. Stir in the melted chocolate now if using.
Raise the speed to medium-high and whip for 2 to 3 minutes until the frosting looks glossy, holds soft peaks, and feels completely smooth.
Adjust the texture: beat in milk one teaspoon at a time for easy spreading, or extra powdered sugar a few spoonfuls at a time for stiff piping peaks.
Use right away to frost cooled cake layers or pipe tall swirls onto cupcakes, or store as directed in the notes.