Skip to content

image — Image

A single image with size, fit, alignment, link, caption and rounded corners.

Displays one image with a rich set of presentation controls: a size preset (sm/md/lg/full) or a fully custom width/height, object-fit (cover/contain), horizontal alignment, an optional link wrapper, a caption, and per-corner border radius. Uploads go through the core upload brick (ImageUploadType + /_content-blocks/upload).

When to use

Any standalone image: hero, inline figure, logo, illustration.

Configuration

Configure under content_blocks_kit.blocks.image (see Configuring blocks for how the levers combine).

Choice fields

Selectable values. Restrict or reorder them per host with choices: (the default is shown in bold).

FieldValues
sizesm, md, lg, full, custom
fitcover, contain
alignstart, center, end

Default data

Initial values for a new block. Override per host with defaults:.

FieldDefault
src''
alt''
sizemd
customWidth600
customHeightAutotrue
customHeight400
fitcover
aligncenter
link''
caption''
borderRadius{"linked":true}

Example

yaml
# config/packages/content_blocks_kit.yaml
content_blocks_kit:
    blocks:
        image:
            choices: { size: [sm, md] }   # restrict / reorder the picker
            defaults: { src: '' }

Front-end

Rendered markup: .cb-kit-image — wraps a <figure> when a caption is present. Style it by overriding the --cb-kit-* custom properties (see the kit stylesheet).

Notes

  • Picking size: custom reveals customWidth / customHeight (with a customHeightAuto toggle) via conditional fields.
  • Requires file storage to be configured for uploads to work.
  • Opts into preview hot-reload — the upload JS is in the sidebar, not the view.

The configuration tables above are generated from content-blocks-kit:blocks --format=json, read straight from the block's code — they never go stale.

Released under the MIT License.