Skip to main content

importShaderById

Materializes a shader into the current file by id and returns it with imported: true and its propertyDefinitions populated. The id is one returned by figma.listAvailableShaders. This is idempotent for a shader that is already imported, and mirrors figma.importComponentByKeyAsync.

Signature

importShaderById(id: string): Promise<Shader>

Remarks

A shader must be imported before it can be applied. Applying an unloaded shader id throws Shader not imported. Call figma.importShaderById(id) first.

const [shader] = await figma.listAvailableShaders()
if (shader && !shader.imported) {
const imported = await figma.importShaderById(shader.id)
console.log(imported.propertyDefinitions)
}