🎈 Welcome to the Marketplace β€” Explore and discover the ecosystem around DatoCMS, and share your own work with the community!

Field value preview

Show a live HTML preview under a field by substituting the current value into a per-field template.

This is a Community Plugin!Β  Learn how create your own plugin, or copy and remix existing ones in our documentation

Field value preview

Field value preview cover

A DatoCMS field addon that renders a live preview under a field by substituting the current value into an HTML template you define.

Editors keep the normal field UI and validation. You configure how the value should look when rendered β€” useful for URL embeds, color swatches, maps, and other β€œwhat will this become?” checks inside the CMS.

What it looks like

Field value preview under a YouTube URL field

Requirements

  • Field type is one of the supported types below
  • Assign Field value preview as a field addon in Presentation
  • Configure Preview HTML with a {{value}} placeholder

Supported field types

Field typeWhat {{value}} receives (before extract pattern)
Single-line string, Multiple-paragraph text, SlugThe text as entered
Integer, Float, BooleanString form of the number/boolean
Date, DateTimeThe stored date/time string
ColorCSS hex (#rrggbb) or rgba(...) when alpha < 1
Locationlatitude,longitude

Not supported: External video (this plugin replaces that workflow with a URL string field), JSON, Modular Content, Structured Text, Single Block, assets, links, SEO.

Preview HTML

Paste the HTML that should appear under the field. Put {{value}} wherever the current field value (or the extracted piece of it) should be inserted. The value is HTML-escaped before substitution.

YouTube URL on a string field

Field value example: https://www.youtube.com/watch?v=wzQWBGkzxSI

Extract pattern

(?:youtube\.com/(?:watch\?.*v=|embed/|shorts/)|youtu\.be/)([\w-]{11})

Preview HTML

&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/{{value}}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;

Color swatch

<div></div>

Raw value

If the field already stores something embed-ready, leave the extract pattern empty:

&lt;iframe
width="100%"
height="315"
src="{{value}}"
title="Embed preview"
frameborder="0"
allowfullscreen
&gt;&lt;/iframe&gt;

Extract pattern

Optional JavaScript regular expression.

WhenWhat {{value}} becomes
Pattern is setCapture group 1, or the full match if there is no group
Pattern is emptyThe normalized field value
Value does not matchAn error under the field instead of a blank preview

Preview height

Optional. Leave empty to auto-size the preview to its content (including embeds that load asynchronously, like X cards). Set a pixel height only when you need a fixed frame.

Empty fields

When the field is empty, the addon shows a short note that the preview appears once a value is present. It does not invent a default.

Install

From npm

  1. In the DatoCMS project, open Settings β†’ Plugins and add datocms-plugin-field-value-preview.
  2. On a supported field, open Presentation, add the Field value preview addon, and paste your preview HTML (and optional extract pattern).

Local development

Terminal window
pnpm install
pnpm --filter datocms-plugin-field-value-preview dev

Then add a private plugin whose entry point is http://localhost:5175/. Use Chrome or Firefox; Safari does not handle localhost plugin iframes well.

If you previously installed this plugin under the old html-field-preview name/URL, remove that private plugin (or switch its entry point) and re-add the addon on your fields β€” extension IDs changed with the rename.

To keep a working Marketplace install untouched, duplicate it and point only the copy at localhost.

Publish

Terminal window
cd plugins/field-value-preview
pnpm publish

The package publishes dist/ plus the marketplace images in docs/. Bump version before each release. Existing DatoCMS installs do not update themselves; use Switch to a different version.

Subscribe to our newsletter! πŸ“₯
One update per month. All the latest news and sneak peeks directly in your inbox.
support@datocms.com Β©2026 Dato srl, all rights reserved P.IVA 06969620480