Skip to main content
Question

Figma API - how to detect whether a node/element is hidden?


Hi All,
I’m writing a plugin to Figma and I want to ignore hidden elements/nodes, but not sure what’s the proper way to do that as it’s not straight forward based on the docs:

  • The node isn’t necessarily visible if this is .visible === true.
  • The node isn’t necessarily invisible if this is .visible === false.
  • An object is visible if .visible == true for itself and all its parents.
    visible | Plugin API

Anyone was able to solve this issue and knows what’s the right logic?

This topic has been closed for replies.

4 replies

tank666
  • 4873 replies
  • January 24, 2024

Check the visible property of both the node itself and its parent, parent’s parent, etc. Or:


  • Author
  • 7 replies
  • January 24, 2024

So for the first approach I will need to traverse the tree until I react visible==false parent, correct?


tank666
  • 4873 replies
  • January 24, 2024

In general, correct. But you may still need to check several properties at once (visible, opacity, absoluteRenderBounds). It all depends specifically on your needs and requirements.

It’s best to test this yourself on the nodes your plugin works with to find edge cases (such as nodes in Boolean operations, maskable objects, and nodes with zero opacity, etc.).


  • Author
  • 7 replies
  • January 25, 2024

Thank you for the helpful advice 🙂


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings