Puck v0.15 introduces powerful new field APIs and numerous quality-of-life features.
resolveFields
API to dynamically define your fields - great for showing fields conditionally or loading external APIs.<Puck>
or <Render>
.Upgrade today or get started with:
npx create-puck-app@latest
Dynamic field resolution via the resolveFields
API allows you to change the field configuration whenever the props change. You can use this to show and hide fields or even load data from an API.
Code example:
const config = {
components: {
MyComponent: {
// ...
resolveFields: (data) => ({
myField: {
type: "radio",
options: [], // Populate dynamically
},
}),
},
},
};
The AutoField component lets you render a Puck field based on a Field object. Use this when building custom fields that need to use Puck-style fields internally.
const CustomField = ({ onChange, value }) => (
<AutoField field={{ type: "text" }} onChange={onChange} value={value} />
);
It’s now possible to implement a custom Publish button without overriding the entire header by using the headerActions
override.
<Puck
overrides={{
headerActions: ({ children }) => (
<>
{/* children will render default Publish button */}
{children}
{/* Or you can define your own */}
<button>Click me</button>
</>
),
}}
/>
This creates a breaking change for existing headerActions
overrides, which will now need to render children
to show the default Publish button.
Components now receive the puck.isEditing
prop. Use this to toggle functionality based on whether the component is being rendered in the <Puck>
or <Render>
context.
const config = {
components: {
MyComponent: {
render: ({ puck }) => (
<div style={{ background: puck.isEditing ? "hotpink" : "transparent" }}>
Hello, world
</div>
),
},
},
};
headerActions
override must now render {children}
(BREAKING CHANGE)In order to support custom Publish buttons, the headerActions
override will no longer render the default Publish button unless children
are rendered.
<Puck
overrides={{
headerActions: ({ children }) => (
<>
{/* Render default Publish button */}
{children}
</>
),
}}
/>
editMode
API deprecatedThe undocumented editMode
prop is now deprecated in favor of puck.isEditing
.
puck
object prop (13bb1bd)lastData
param (dd7051e)See the GitHub release for the full changelog.
We’re grateful for the community’s support and contributions. Join the conversation on GitHub and Discord.
A huge thanks to all our existing and new contributors:
If you’re interested in learning more about Puck, check out the demo or read the docs. If you like what you see, please give us a star on GitHub to help others find Puck too!