Slot

The Slot control provides your component with a ReactNode of components dropped visually in the Makeswift builder.

AnchorExamples

AnchorA simple box

In this example we register a Box component and control its children prop using a Slot control.

import { ReactRuntime } from '@makeswift/runtime/react'
import { Slot } from '@makeswift/runtime/controls'

function Box({ children }) {
  return (
    <div style={{ width: '100%', margin: '0 auto', border: '4px solid skyblue', borderRadius: 16 }}>
      {children}
    </div>
  )
}

ReactRuntime.registerComponent(Box, {
  type: 'box',
  label: 'Box',
  props: {
    children: Slot(),
  },
})

AnchorAPI

AnchorParameters

The Slot control currently doesn't take any parameters.

AnchorProvided value

The Slot control provides a ReactNode value to your component.