Skip to main content
Jonah_Goldsaito
February 12, 2024
Solved

Adding a shadow to a frame via a plugin

  • February 12, 2024
  • 3 replies
  • 490 views

Based on the plugin Effect API page, I would assume this is the right format for assigning an drop shadow to a node:

newFrame.effects = [{
type: “DROP_SHADOW”,
color: {r: 0, g: 0, b: 0, a: 1},
offset: { x: 0, y: 4},
radius: 4,
}];

Unfortunately it fails silently. Anyone know how to do this properly?

Also, for any Figma team members out there, would be great to:

  • Get an error that highlights the malformed property causing this to fail
  • Have an example on the API page
This topic has been closed for replies.
Best answer by tank666

Add all required properties (including blendMode, visible).

figma.com

You should see errors in the console.

3 replies

tank666
tank666Answer
February 12, 2024

Add all required properties (including blendMode, visible).

figma.com

You should see errors in the console.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Jonah_Goldsaito
February 12, 2024

Hey @tank666, thanks!

I didn’t notice the ? syntax on the variable names. That fixed it! 🙌

Notes to the Figma team:

  • Why are properties like visible and blendMode not given very obvious defaults of true and NORMAL respectively? The blendMode description even says, "The typical default value is “NORMAL”.
  • Showing an error for what’s missing would be amazing!
  • Stating required in plain text in the description would be way harder to miss.
Jonah_Goldsaito
February 12, 2024

Oops. Was missing the error amongst other noise.