Penpot plugins API
    Preparing search index...

    Interface Variants

    TODO

    interface Variants {
        id: string;
        libraryId: string;
        properties: string[];
        currentValues(property: string): string[];
        removeProperty(pos: number): void;
        renameProperty(pos: number, name: string): void;
        variantComponents(): LibraryComponent[];
        addVariant(): void;
        addProperty(): void;
    }
    Index

    Properties

    id: string

    The unique identifier of the variant element. It is the id of the VariantContainer, and all the VariantComponents that belong to this variant have an attribute variantId which this is as value.

    libraryId: string

    The unique identifier of the library to which the variant belongs.

    properties: string[]

    A list with the names of the properties of the Variant

    Methods

    • A list of all the values of a property along all the variantComponents of this Variant

      Parameters

      • property: string

        The name of the property

      Returns string[]

    • Remove a property of the Variant

      Parameters

      • pos: number

        The position of the property to remove

      Returns void

    • Rename a property of the Variant

      Parameters

      • pos: number

        The position of the property to rename

      • name: string

        The new name of the property

      Returns void

    • Creates a duplicate of the main VariantComponent of this Variant

      Returns void

    • Adds a new property to this Variant

      Returns void