Docs
Getting Started

Welcome to Puck

Render the editor

// Editor.jsx
import { Puck } from "@measured/puck";
import "@measured/puck/dist/index.css";
 
// Create puck component config
const config = {
  components: {
    HeadingBlock: {
      fields: {
        children: {
          type: "text",
        },
      },
      render: ({ children }) => {
        return <h1>{children}</h1>;
      },
    },
  },
};
 
// Describe the initial data
const initialData = {
  content: [],
  root: {},
};
 
// Save the data to your database
const save = (data) => {};
 
// Render Puck editor
export function Editor() {
  return <Puck config={config} data={initialData} onPublish={save} />;
}

Render the page

// Page.jsx
import { Render } from "@measured/puck";
 
export function Page() {
  return <Render config={config} data={data} />;
}

Recipes

Puck is a React component that can be easily integrated into your existing application. We also provide helpful recipes for common use cases: