Frame around text

I want to make interactive panels with text. To generate text I use troika-three-text. How do I determine the dimensions of the text to create a rectangle or frame around the text?