Skip to content

GridStyle

Layout grid style

Grid style properties

type

  • Readonly: true
  • Type: TEXT

layoutGrids

  • Type: ReadonlyArray<LayoutGrid>
  • Type Declaration: LayoutGrid

An array of layout grids.

Base style properties

id

  • Readonly: true
  • Type: string

The unique identifier of this style in the document. You can use this value when setting layer properties such as fillStyleId, strokeStyleId, textStyleId, etc., to bind the layer to this style.

name

  • Type: string

The name of the style.

description

  • Type: string
  • Tip: Cross-thread communication

The description of the style.

getPluginData

  • Type: getPluginData(key: string): string

Retrieves custom data stored on the node, which is private to your plugin. If you want to retrieve values other than strings, decode them with JSON.parse first.

setPluginData

  • Type: setPluginData(key: string, value: string): void

Allows you to store custom data on any node, private to your plugin. If you want to store values other than strings, encode them with JSON.stringify first.

getPluginDataKeys

  • Type: getPluginDataKeys(): string[]

Returns all keys of data stored by the current plugin.

getSharedPluginData

  • Type: getSharedPluginData(namespace: string, key: string): string

Retrieves shared data stored under a specific namespace.

setSharedPluginData

  • Type: setSharedPluginData(namespace: string, key: string, value: string): void

This lets you store custom data on any node. You can retrieve it later by calling getSharedPluginData with the same namespace and key. To find all data keys stored on a node under a specific namespace, use getSharpedPluginDataKeys.

Any data written via this API can be read by any plugin. The purpose is to allow plugins to interoperate. If you don't want other plugins to be able to read your data, use setPluginData instead.

You must also provide a namespace to avoid key collisions with other plugins. This parameter is required to prevent multiple plugins from using common key names (such as data) and overwriting each other. We recommend passing a value that identifies your plugin. You can share this namespace with other plugin authors so they can read data from your plugin.

A namespace is a unique string used to identify your plugin and avoid key collisions with other plugins. The namespace must contain at least 3 alphanumeric characters.

getSharedPluginDataKeys

  • Type: getSharedPluginDataKeys(namespace: string): string[]

Finds all keys of shared data stored on the node under a specific namespace.

Publishable properties

remote

  • Readonly: true
  • Type: boolean
  • Tip: Cross-thread communication

Whether this style comes from a team library. Remote styles are read-only: attempting to modify their properties will throw.

key

  • Readonly: true
  • Type: string

Used together with pixso.importStyleByKeyAsync. Note that while this key exists on both local and published styles, you can only import published styles.

getLibraryInfoAsync

  • Type: getLibraryInfoAsync(): Promise<{key: string, name: string}>
  • Tip: Cross-thread communication

Gets the key of the library this style belongs to. You can use pixso.getLibraryByKeyAsync(key) to retrieve information about that library.