Support showing arbitrary data from contexts in on-page elements

Feature Request.

Currently it’s possible to link some of element props to component props. For example, link Image to Top menu props, so I can change that prop on page where I use Top menu component, and Image changes.

My suggestion is to make it possible to link prop (for example, Image or Text) to context’s value. So developers can define Global Context or something like Local Context and designers can use values directly from them without needing to use code components ProductTitle, ProductDescription etc. Or use variants from context’s values that are of choice or boolean type.

So developers don’t need to create a lot of code components for each value. Designers can easily use that values and design components fully from Plasmic.

Instead of creating UserName, UserAvatar16px, UserAvatar64px, UserBio, UserLevel, etc, we can define Global Context UserContext and just use that values in any Text element. Or even use User.type (normal, admin, moderator) or User.hasVerifiedEmail as Variant.

Instead of creating ProductTitle, ProductDescription, ProductPrice, ProductImage, ProductLink, ProductRecommendedBadge, we can create Local Context ProductContext and use values inside ProductContextProvider for our Text, Image elements. Or even use Product.isRecommended or Product.isAvailable as Variant.

image.png

Hey @electronic_falcon! This is one of the most exciting features we’re about to launch. We’re calling data binding, and it will simplify our current flow. You will have total flexibility to read data from a global/local context and link to any attribute or prop.

We’re currently in phase test, but for now, we exposed a dataSelector prop type to code-component. It receives an object as input, and it will render a data picker. This may help you to reduce the number of code-components in your project.

Thank you for the suggestion. We’re very happy to see that the Plasmic Community is also eagerly for this feature.

Oh, that’s a good news! I have already explored the source code of graphcms code components where dataSelector is used. But the data binding feature must be more convenient, hope it will be released soon!

Hi! Is it planned to add dynamic values for variants? I would like to set variant based on values from DataProvider

yup that is planned