Twigs, leaves and sap are ingredients used to open more spaces in your storage so you can store butterflies.
You can get storage ingredients as mission rewards, in friend gifts, in gifts generated by the game (such as butterflies which create gifts), as a reward for levelling up your beefly, for some achievements and sometimes as prizes from the video snail!
To expand storage you must scroll down to the bottom of the storage area and tap the box which displays the ingredients. If you have enough ingredients they will be displayed in green, or if not they will be displayed in red. The numbers show how many of an item is required to expand so if your box said you had 12/4 twigs, you have enough twigs for 3 slots. But you may only have 1/4 leaves. Tap the box and then “expand” along the bottom toolbar to expand. If you have enough ingredients it will not cost you, but if you don’t want to wait you can expand using flutterbucks!