figma.teamLibrary
The TeamLibrary API is designed to work with library files and assets enabled for the current file. These libraries must be enabled manually via the UI, see Manage libraries in design files for more info.
teamlibrary
must be specified in the permissions array in manifest.json
to access this property.
{
"permissions": ["teamlibrary"]
}
If your manifest doesn't contain these fields, the teamLibrary API methods described below will throw errors if you try to use them.
getAvailableLibraryVariableCollectionsAsync(): Promise<LibraryVariableCollection[]>
Returns a descriptor of all VariableCollection
s that exist in the enabled libraries of the current file. Rejects if the request fails.
This requires that users enable libraries that contain variables via the UI. Currently it is not possible to enable libraries via the Plugin API.
getVariablesInLibraryCollectionAsync(libraryCollectionKey: string): Promise<LibraryVariable[]>
Returns a descriptor of all Variable
s that exist in a given LibraryVariableCollection
.
Rejects if the given variable collection does not exist, or if the current user
does not have access to that variable collection's library, or if the request fails.