Skip to Content
Delmare Digital

Puck and field exports

Exports for Puck render and editor configs, Payload fields and blocks, and the admin stylesheets.

/puck

For Puck render configs. Import from @delmaredigital/payload-experiments/puck.

ExportPurpose
experimentsPuck({ routes? })One integration object for payload-puck's extendConfig({ integrations }): the Experiment block and its A/B tests category
ExperimentSlot, createExperimentSlot({ routes })The render component, with default or custom routes
EXPERIMENT_SLOT_TYPE'ExperimentSlot', the component key
createExperimentSlotField({ label?, routes? })The test picker as a Puck custom field, for other components
xpGoalPuckField()The click-goal prop for render configs (a text field)
ExperimentsPuckIntegration, PuckRoutes, ArmSlot, ExperimentRef, ExperimentSlotPropsTypes

/puck/editor

For Puck editor configs, in a 'use client' module. Import from @delmaredigital/payload-experiments/puck/editor.

ExportPurpose
experimentsPuckEditor({ routes?, accent? })One integration object for PuckConfigProvider's integrations: the editor block, its category and the outline plugin. Create it once at module scope
ExperimentSlotEditor, createExperimentSlotEditor({ routes, accent })The editor component
experimentOutlinePlugin()Hides empty version slots the test doesn't use from Puck's outline
xpGoalPuckEditorField({ routes? })The click-goal picker with inline creation
deriveAccentThe accent derivation used by the admin theme

PuckRoutes is { admin?: string; api?: string }, defaulting to /admin and /api.

Package root fields and blocks

From @delmaredigital/payload-experiments:

ExportPurpose
createExperimentBlock({ blocks, slug? })The Experiment block for a Payload blocks field. Default slug xpExperiment
EXPERIMENT_BLOCK_SLUG'xpExperiment'
xpGoalField()A text field named xpGoal with the click-goal picker
createArmSelectField({ flagPoint, name?, label?, required? })Tag host content with a test group. Default name experimentArm
defineFlagPoint, defineMetricSourceTyped identity helpers
contentDone(report)true when every entry in a make-content report is updated or dismissed

/blocks

From @delmaredigital/payload-experiments/blocks: controlOnlyBlocks(blocks, blockSlug?), segmentExperimentBlocks(blocks), EXPERIMENT_BLOCK_SLUG and the block types.

Stylesheets

ExportUse
@delmaredigital/payload-experiments/puck/editor.cssInside the Puck editor iframe
@delmaredigital/payload-experiments/admin/theme.cssPuck outside the Payload admin
@delmaredigital/payload-experiments/admin/ui.cssPuck outside the Payload admin
Edit this page on GitHub

On this page