Aw OP this has made me sad. This was me at school, exactly as you have described your little girl - I was chatty, confident etc at home but as soon as I was around unfamiliar people (even most extended family) or at school I just felt this crushing anxiety and couldn’t speak even though I wanted to. I also loved reading and was good at it, and even though I knew all the answers to the questions asked I never once put my hand up.
If I’d been forced to it would have made it worse, there were “group discussions” where everyone would take a turn to speak about a toy or book they liked and I would just sit there in silence wanting the ground to swallow me up - either that or I’d go home for lunch and tell my mum I didn’t feel well to get out of it.
I was always told I was quiet and “has the cat got your tongue?” which I hated.
What helped me greatly was (I didn’t know at the time obviously) my mum talking to the teacher and “pairing me up” with another lovely little girl who would sit next to me and chat away, we did projects together and became really close which in turn helped me with other people because I had someone to “bounce off” if that makes sense? We are still friends to this day (I’m almost 30!)
I also remember a conversation I had with my mum very vividly, I must have been about 6, she asked me why I didn’t like to speak in school and I said I didn’t know. She then came up with scenarios where she pretended to be a teacher or classmate and I had to respond the way I wanted to (but couldn’t in real life)
We did one where I had lost my pencil sharpener and couldn’t do my work. So I asked her for a sharpener and she let me borrow it and I said thank you and gave it back. It all sounds very simple but at that age it made me see that it’s the same situation just in a different setting and nothing “bad” was going to happen. She told me that if I spoke in school no one is going to say “omg Kite is speaking” or laugh at me, because it’s totally fine and normal! This made me laugh because I knew I could do it and I imagined how silly it would be to laugh at someone just for speaking.
It did take a good few years for me to feel comfortable and I was always “quieter” but I now realise that that is absolutely fine. I even went on to win a prize in secondary for my talk on a novel! Then went off to uni to do English which includes lots of talks and discussion!
I really hope you can help your little one, it can be so hard to know what to do in this situation. Especially when most kids are loud and chatty.
Sorry about the poor grammar/ spelling I’m using a new phone.
Feel free to PM me 😊