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
| Property | Type | Description |
|---|---|---|
type | 'image' | Required. |
name | string | Field identifier. |
label | string | Display label in the editor. |
list | boolean | Store multiple images as an array. |
ui.format | (value: string) => string | Transform value before displaying. |
ui.parse | (value: string) => string | Transform 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
},
},
}