Penpot plugins API
    Preparing search index...

    Type Alias LibraryContext

    Represents the context of Penpot libraries, including both local and connected libraries. This type contains references to the local library and an array of connected libraries.

    type LibraryContext = {
        local: Library;
        connected: Library[];
        availableLibraries(): Promise<LibrarySummary[]>;
        connectLibrary(libraryId: string): Promise<Library>;
    }
    Index

    Properties

    local: Library

    The local library in the Penpot context.

    const localLibrary = libraryContext.local;
    
    connected: Library[]

    An array of connected libraries in the Penpot context.

    const connectedLibraries = libraryContext.connected;
    

    Methods

    • Retrieves a summary of available libraries that can be connected to.

      Returns Promise<LibrarySummary[]>

      Returns a promise that resolves to an array of LibrarySummary objects representing available libraries.

      const availableLibraries = await libraryContext.availableLibraries();
      
    • Connects to a specific library identified by its ID.

      Parameters

      • libraryId: string

        The ID of the library to connect to.

      Returns Promise<Library>

      Returns a promise that resolves to the Library object representing the connected library.

      const connectedLibrary = await libraryContext.connectLibrary('library-id');