How to obtain all textStyles in teamLibrary?
There is a node in the current file that uses local textStyle. I want to replace it with textStyle from teamLibrary. At present, I can obtain all textStyles locally based on getLocalTextStylesSync(). So how can I obtain all textStyles and their detail information in teamLibrary?
Hi @Dang-xiaorui - I don't believe this is currently possible with the Plugin API. I've shared the feedback with the team. Please feel free to share additional context about your specific use-case so that I can help provide that to the team for prioritization
For typography, figma has the concept of Text Styles. I am currently developing a figma plugin that can replace the Text Styles of text nodes. For example, there is a text node that uses a local Text Style called "Small Text". I want to replace it with Text Style from teamLibrary, also known as "Small Text". Therefore, I need to retrieve all Text Styles from teamLibrary and find the Text Style named "Small Text" from it. So how can I obtain all textStyles and their detail information in teamLibrary?
Thanks for sharing, @Dang-xiaorui. While this info isn't available via the Plugin API, you could make a REST API call to the GET team styles endpoint along with the importStyleByKeyAsync method to get that information.
Thanks for responding.But how do I get the team ID of all team libraries?
Hey @Dang-xiaorui - It is not possible to programmatically obtain team IDs. To obtain a team ID, navigate to the team page in the Figma file browser. The team ID is present in the URL after the word team and before your team name.
In the following example:
https://www.figma.com/files/787077228518093158/team/101536658047301531/Advocacy
101536658047301531 is the team ID