Tinacms Developer Docs
Fields

Image Field

A file input for uploading and storing image URLs

A file input that stores the URL or path of an uploaded image. Supports drag-and-drop uploads and integrates with the media manager.

Usage

{
  type: 'image',
  name: 'heroImage',
  label: 'Hero Image',
}

Options

PropertyTypeDescription
type'image'Required.
namestringField identifier.
labelstringDisplay label in the editor.
listbooleanStore multiple images as an array.
ui.format(value: string) => stringTransform value before displaying.
ui.parse(value: string) => stringTransform value before saving.

Type Signature

interface ImageField {
  type: 'image'
  name: string
  label?: string
  list?: boolean
  ui?: {
    format?: (value: string) => string
    parse?: (value: string) => string
  }
}

Examples

Path Formatting

Add or remove leading slashes from image paths:

{
  type: 'image',
  name: 'heroImage',
  label: 'Hero Image',
  ui: {
    format(value) {
      return value?.startsWith('/') ? value : `/${value}`
    },
    parse(value) {
      return value?.startsWith('/') ? value.slice(1) : value
    },
  },
}

On this page