diff --git a/apps/docs/pages/docs/integrating-puck/multi-column-layouts.mdx b/apps/docs/pages/docs/integrating-puck/multi-column-layouts.mdx index 29f1f3903d..70613f6c15 100644 --- a/apps/docs/pages/docs/integrating-puck/multi-column-layouts.mdx +++ b/apps/docs/pages/docs/integrating-puck/multi-column-layouts.mdx @@ -76,6 +76,8 @@ const config = { +You can also use DropZones in the `root` render function to change the default layout. See [Root DropZones](#root-dropzones) + ## Fixed layouts Combine multiple DropZones to achieve fixed layouts. By default, components inside a DropZone are arranged along the vertical (`block`) axis. @@ -410,6 +412,92 @@ const config = { }; ``` +## Root DropZones + +The `root` uses a DropZone internally. When providing a render function to `root`, the `children` prop renders a DropZone for a zone called **default-zone**. + +```tsx showLineNumbers copy {4-5} +const config = { + root: { + render: ({ children }) => { + // children renders + return
{children}
; + }, + }, +}; +``` + +Instead of rendering children, use DropZone to achieve multi-column layouts at the root: + +```tsx showLineNumbers copy {4-7} +const config = { + root: { + render: () => ( +
+ + +
+ ), + }, +}; +``` + + ( +
+ + +
+ ), + }, + components: { + Card: { + render: ({ content }) => { + return ( +
+ {content} +
+ ); + }, + }, + }, + }} + data={{ + content: [], + root: { props: {} }, + zones: { + "root:left-column": [ + { + type: "Card", + props: { id: "Example-2", content: "1" }, + }, + ], + "root:right-column": [ + { + type: "Card", + props: { id: "Example-3", content: "2" }, + }, + ], + }, + }} +> + +
+ +When passing **default-zone** to a DropZone in the root render function, the component data will be stored under [`content`](/docs/api-reference/data#content). Otherwise, the component data will be stored under [`zones`](/docs/api-reference/data#zones) + ## Further reading - [The `` API](/docs/api-reference/components/drop-zone)