Watch Webinar: Figma - Design to Code in 80% Less Time

Announcing Visual Copilot - Figma to production in half the time

Builder.io logo
Talk to Us
Platform
Developers
Talk to Us

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

Vercel Visual Editing is a feature within the Vercel site preview that adds a clickable link to any content powered by a Builder data model on your site. When clicked, this link will take you to the corresponding content entry within Builder. Once set up for your project, it will look like the following example.

Image of a theoretical company tile with the Open in Editor clickable link.

The first requirement to using Vercel Visual Editing in your Builder-powered Next.js site is to have something on your site powered by a Builder data model.

Next, use the Builder v3 Content API. Upgrade your React SDK to the latest version if your version does not support the apiVersion setting.

npm update @builder.io/react@latest

With an updated SDK version that supports the Builder v3 content API, add the following to your Next.js project.


  • Better support for localization (coming soon): The content API will provide improved support for localization, including querying based on localization features.
  • Support for multi-level nested references (coming soon): The content API will allow you to query, resolve, and return content that has nested references of other contents and symbols.
import { builder } from "@builder.io/react";

builder.init('YOUR_BULDER_PUBLIC_API_KEY');
builder.apiVersion = "v3";

Then, when making the call to fetch the data from Builder, you need to include the vercelPreview parameter and set it to true.

Make sure to include the logic that only sets this flag to true when Vercel is in preview mode, so your production deployments do not have the additional metadata that is added to make the Edit button display.

  const content = await builder.getAll("SOME_DATA_MODEL_NAME", {
    options: {
      vercelPreview: process.env.VERCEL_ENV === 'preview',
    },
  });

For more detail, read Vercel's documentation on Visual Editing.

Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Newsletter

Get the latest from Builder.io

By submitting, you agree to our Privacy Policy