Home App Docs Blog Github

How do I modify Builder content programmatically via code?

Let’s say for example you need to apply a special dynamic property to some Builder content. The way to accomplish that is by writing plugin code that iterates over all the builder elements in a piece of content, something like:

import { autorun } from 'mobx'
const context = require('@builder.io/spplication-context').default

autorun(() => {
  context.designerState.editingContentModel?.allEditingElements.forEach((item) => {
    <insert your code here>
}, { timeout: 5000 })