image

Media library image picker. Stores a full image object — URL, alt, dimensions, optional focal point, and (when enabled) sizing / repeat / fixed-background config.

Stored value

object — { url, alt, width, height, id, focalPoint?, size?, isRepeat?, isFixed? }

Supports

  • Media library picker with full image metadata
  • Optional FocalPointPicker for cover-cropping
  • Optional cover / contain / tile size selectors with custom width
  • Optional background-repeat and fixed-background toggles

Config options

enableFocalPointbooleandefault: true
Show the FocalPointPicker so the author can choose a focus point for cover-cropping.
enableSizeOptionsbooleandefault: true
Show cover / contain / tile + custom-width selectors.
enableRepeatOptionsbooleandefault: true
Toggle for background-repeat (active when size !== "cover").
enableFixedBackgroundbooleandefault: true
Toggle for `background-attachment: fixed`.

Example

json
{ "id": "ctrl_cover",
  "type": "image",
  "label": "Cover image",
  "attributeKey": "cover",
  "validation": { "required": true },
  "parentPanelId": "panel" }

Gotchas

Heads up
Optional fields only appear when the corresponding `enable*` flag is on AND the author touched the control. Always destructure with defaults in React.

Notes

Consume

export default function Hero({ attributes }) {
  const cover = attributes.cover;
  if (!cover?.url) return null;

  return (
    <div
      className="hero"
      style={{
        backgroundImage: `url(${cover.url})`,
        backgroundSize:  cover.size || 'cover',
        backgroundPosition: cover.focalPoint
          ? `${cover.focalPoint.x * 100}% ${cover.focalPoint.y * 100}%`
          : 'center',
      }}
    />
  );
}