With rats if you are only using pellets when the litter is born you will lose most of your babies. (With mice you won’t I only use pellets when they have their babies and they do fine)
What I do is that I use pellets in my breeding tubs once the female is ready to have her babies I set the enclosure with less than half of the pellets I usually use along with wood shaving.
I do that from the birth of the babies until they are 2 weeks old.
Once they are 2 weeks old I only use pellets.