Skip to content

Block Attributes ​

The gallery block's stored shape — what each attribute holds, and its default.

The block is shaped-gallery/gallery. Everything a gallery is lives in its attributes, serialized into post content.

Read this alongside the inspector reference

Each attribute maps to a control. The Gallery Block says what each control does; this page says what it stores.

Conventions ​

Three shapes recur throughout.

Responsive scalar — one value per device, plus a unit:

json
{ "desktop": 4, "tablet": 3, "mobile": 2, "unit": "px" }

Box model — per device, with an optional unit:

json
{ "desktop": { "top": 8, "right": 16, "bottom": 8, "left": 16 }, "tablet": {}, "mobile": {}, "unit": "px" }

Grouped object — related settings under one key (imageVideo, content, ajaxPagination, filterSearch, motion, advanced, lightbox).

Core ​

AttributeTypeDefaultHolds
uniqueIdstring—The gallery's CSS scope.
galleryIdnumber—The saved gallery's post id, when it is one.
layoutstringjustifiedOne of justified, grid, masonry, metro, thumbnails, staggered, perspective.
itemsarray[]The media items.
categoriesarray[]This gallery's category vocabulary, as { id, name }.
providerstringmedia_libraryThe source the gallery was built from.
orderstringdefaultdefault or random.
clickActionstringlightboxlightbox, url or none.

Never rewrite uniqueId or items[].id

uniqueId is the gallery's style scope — two galleries sharing one would share CSS. Item ids are meaningful only on the site that authored them, which is why imported patterns have all three stripped on the way in.

Shared layout ​

AttributeTypeDefault
columnsresponsive4 / 3 / 2
horizontalGapresponsive15 px
verticalGapresponsive15 px
marginbox modelempty

Per-layout ​

Justified ​

AttributeTypeDefault
rowHeightModestringauto
maxRowHeightnumber280

Staggered ​

AttributeTypeDefault
staggeredImageHeightstringcustom
staggeredImageHeightSizenumber280
preserveLayoutGapsresponsive50 %

Metro ​

AttributeTypeDefault
featuredImageSizestring2

Stored but currently not exposed as a control — Metro ships as a fixed mosaic.

Thumbnails ​

AttributeTypeDefault
thumbnailCountresponsive5 / 4 / 3
thumbnailPositionstringbottom
thumbnailAreaWidthstringauto
thumbnailAreaWidthSizeresponsive500 / 400 / 300 px
thumbnailSideWidthresponsive110 px
thumbnailHeightresponsive90 px
thumbnailGapresponsive8 / 8 / 6 px
activeThumbnailStylestringborder-around
thumbnailAlignmentstringleft
thumbnailNavArrowbooleanfalse
thumbnailStyleobject(see below)

thumbnailStyle holds autoplay, slidingSpeed (500), hoverEffect (normal), activeBorderWidth (2 px), activeBorderColor (#3858e9), the area's areaBackground / areaBorder / areaBorderWidth / areaBorderRadius / areaPadding, plus pauseOnHover (true), infiniteLoop (true) and keyNavigation (false).

Perspective ​

AttributeTypeDefault
gallerySizeobjectwidth empty (auto), height 700 px
perspectiveModestringtable
slideDirectionstringup
slideSpeednumber3
perspectiveDepthresponsive800 px
rotateX · rotateY · rotateZresponsive0 deg
edgeFadebooleanfalse
alternateColumnsbooleanfalse
mouseTiltbooleantrue
mouseParallaxresponsive1

imageVideo ​

KeyDefault
resolutionlarge
lazyLoadtrue
imagePreloaderfalse
imageWatermarkfalse
rightClickProtectionfalse
videoPlayModeinline
autoplaytrue
playIconSize48
displayIconOnHoverfalse
hoverAnimationzoom
animationDuration500
style.normal · style.hoverper-state filter, opacity, overlay, border, radius, shadow

content ​

KeyDefault
imageTitlefalse
imageTitleSourcetitle
imageTitleTagh4
imageDescriptionfalse
imageDescriptionSourcecaption
descriptionLimit4 lines
displayStyleclassic
overlayStylefull
contentVisibilityalways
overlayOpacity0.4
overlayPositioncenter
overlaySize75
positionbottom
alignmentleft
titleToDescGap16 px
Title / description typography, sizes, colours, plus the box's background, border, radius and paddingunset

Overlay keys are always stored

They persist even while Content Display Style is Classic, so a gallery switching back and forth keeps its overlay configuration.

One key: clickActionType, default full_image.

Everything else about the lightbox — which icon, its style, position, offset, and the whole viewer — is site-wide, in the Lightbox module's own settings, and merged in at render time. It is never stored on the block. Why →

ajaxPagination ​

KeyDefault
enablefalse
typeload_more
numberTypenumber
numberGap10 px
infinityLoadfalse
showPerView15
buttonLabelLoad More
endingMessageNo more images available
alignmentcenter
styletypography, per-state button colours, radius, padding, margin

filterSearch ​

KeyDefault
enablefalse
filterStyleminimal
displayCountfalse
showAlltrue
allLabelAll
filterGap16 px
imageSearchfalse
searchBarStyleminimal
placeholdertrue
placeholderTextSearch
searchWidth25 %
alignmentleft
orientationinline
barGap16 px
justifyflex-start
style · searchStylethe chip and field styling bundles

motion ​

KeyDefault
entranceAnimationnone
animationSpeed1
animationDelay0

advanced ​

KeyDefault
backgroundunset
padding · marginempty box model
visibility.modepublic
visibility.password''
visibility.hideDesktop · hideTablet · hideMobilePortrait · hideMobileLandscapefalse
customCssClass · customCssId''

advanced.customCss may exist and is inert

Galleries built before the per-gallery CSS field was removed still carry the key. Nothing reads it and nothing prints it. It isn't migrated away, because rewriting every post to strip an inert key is a destructive pass for no gain.

Item shape ​

Each entry in items is a normalised media item, whatever provider it came from:

KeyHolds
idAttachment id, or the URL for an external item.
typeimage or video.
url · thumb · fullThe display, thumbnail and full-size sources.
width · heightIntrinsic dimensions, used by the measured layouts.
alt · title · caption · descriptionPer-gallery text overrides. An empty value falls back to the attachment.
linkThe custom URL.
categoriesThis gallery's category ids the item belongs to.
providerWhich provider produced it.

Things worth knowing ​

Defaults live in one place. Every default above is declared once and read by both the editor and the server, so a control and its rendering can't disagree.

Every value is re-validated on render. Attributes are block data, which means a user can edit them — so enums are allow-listed and numbers are clamped on the server, not trusted from the block.

Adding an attribute is a five-step change: the schema, the generated block.json, server-side validation and default, the inspector control, and something that consumes it. An attribute with no consumer is a control that saves and does nothing.

Where to go next ​