Hi looking at your setup there are a few things that complicate this, which is probably why nobody has answered yet.
First I would map the texture to the instances in the shader editor not the GN editor this will give you more mapping options.
You are using a text object for the instances.
You can not use UV cords for a text object……well you can but text gives you random uv values for each triangle and you can not unwrap it, so you would find it imposible to map your rainbow horizontaly across the text.
This limits your usefull mapping options to object or generated. To map as you are doing the easiest would be to use generated like this: (the mapping will sttay consistent even if you edit the text and make it longer or shorter)
Note: I did not realize the instances.
The next problem is that you are realizing the instances. If you realize the instances using object or generated cords it will mess up the mapping because the instances no longer exist and they all form part of one new object. Object or generated cords will refere to this new “compound object” and map across it as a whole.
So the big question is:
Do you really need to realize the instances for some specific reason?
If the answer is “no” do not do it. The easiest thing to do is to use generated cords like my example.
If the answer is “yes” the other way to do it would be to covert your text to mesh and UV unwrap it (before using the GN modifer).
So the next question is: Do you need the text instance object to stay editable as text?
If not covert the text object to mesh (without the GN modifier) and unwrap it (project from view bounds).
Then you can make a new GN setup like this and enter the UV map as an atribute in the shader editor and realise the instances.
Then in the shader setup you can input the UVMap with the “Atribute” node or the “UVMap” node. It will not work with the texture coordinate node’s UV output.
I hope that all makes sense, as far as I know there is no way to do it without either “not realizing” instances or converting the text to mesh.
Here are the files, in the first one the text is still text but I did not realize the instances, in the second one I coverted the text to mesh and did realise the instances.
Burger.blend (88.6 KB)
Burger2.blend (250.9 KB)