Home App Docs Github

Children as prop of default children

{
  '@type': '@builder.io/sdk:Element',
  component: {
    name: 'Button', options: {
      children: {
        '@type': '@builder.io/sdk:Element',
        component: { name: 'Text', options: { text: 'Call To Action' } }
      },
      href: '#'
    }
  }
}

how do this ?

To clarify, you have a custom comoponent called Button that has the canHaveChildren set to true and you want to use it as part of the defaultChildren for another custom component?

If so, try to pass the children as an array
Edit: pass children as an array to the element instead.

defaultChildren: [ {
  '@type': '@builder.io/sdk:Element',
  children: [{
    '@type': '@builder.io/sdk:Element',
    component: { name: 'Text', options: { text: 'Call To Action' } }
  }],
  component: {
    name: 'Button',
    options: {
      href: '#'
    }
  }
}]

Also make sure to use the provider HOC withChildren as in this example