Theme.json Version 2 Reference

This is the specification for version 2 of theme.json. This version works with WordPress 5.9 or later.

Theme.json version 3 has been released with WordPress 6.6. WordPress will continue to support theme.json version 2. However new features will only be added to [new versions](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/).

When you are ready to upgrade, see the [theme.json migration guide](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-migrations/#migrating-from-v2-to-v3) for details on updating to the latest version.

This reference guide lists the settings and style properties defined in the theme.json schema. See the theme.json how to guide for examples and guidance on how to use the theme.json file in your theme.

JSON Schema

This documentation was generated from the JSON schema for theme.json.

The last schema for version 2 is available at `https://schemas.wp.org/wp/6.5/theme.json`.

Theme.json schemas for each WordPress version are available at https://schemas.wp.org/wp/{{version}}/theme.json`. For example a schema for WordPress 5.9 is available athttps://schemas.wp.org/wp/5.9/theme.json`.

See Developing with theme.json for how to use the JSON schema in your editor.

Settings

appearanceTools

Setting that enables the following UI tools:

  • background: backgroundImage, backgroundSize
  • border: color, radius, style, width
  • color: link
  • dimensions: aspectRatio, minHeight
  • position: sticky
  • spacing: blockGap, margin, padding
  • typography: lineHeight

useRootPaddingAwareAlignments

Enables root padding (the values from styles.spacing.padding) to be applied to the contents of full-width blocks instead of the root block.

Please note that when using this setting, styles.spacing.padding should always be set as an object with top, right, bottom, left values declared separately.


border

Settings related to borders.

PropertyTypeDefaultProps
colorbooleanfalse
radiusbooleanfalse
stylebooleanfalse
widthbooleanfalse

shadow

Settings related to shadows.

PropertyTypeDefaultProps
defaultPresetsbooleantrue
presetsarrayname, shadow, slug

color

Settings related to colors.

PropertyTypeDefaultProps
backgroundbooleantrue
custombooleantrue
customDuotonebooleantrue
customGradientbooleantrue
defaultDuotonebooleantrue
defaultGradientsbooleantrue
defaultPalettebooleantrue
duotonearraycolors, name, slug
gradientsarraygradient, name, slug
linkbooleanfalse
palettearraycolor, name, slug
textbooleantrue
headingbooleantrue
buttonbooleantrue

background

Settings related to background.

PropertyTypeDefaultProps
backgroundImagebooleanfalse

dimensions

Settings related to dimensions.

PropertyTypeDefaultProps
aspectRatiobooleanfalse
minHeightbooleanfalse

layout

Settings related to layout.

PropertyTypeDefaultProps
contentSizestring
wideSizestring
allowEditingbooleantrue
allowCustomContentAndWideSizebooleantrue

Settings related to the lightbox.

PropertyTypeDefaultProps
enabledboolean
allowEditingboolean

position

Settings related to position.

PropertyTypeDefaultProps
stickybooleanfalse

spacing

Settings related to spacing.

PropertyTypeDefaultProps
blockGapboolean, nullnull
marginbooleanfalse
paddingbooleanfalse
unitsarraypx,em,rem,vh,vw,%
customSpacingSizebooleantrue
spacingSizesarrayname, size, slug
spacingScaleobject

typography

Settings related to typography.

PropertyTypeDefaultProps
customFontSizebooleantrue
fontStylebooleantrue
fontWeightbooleantrue
fluidobject, booleanfalse{maxViewportWidth, minFontSize, minViewportWidth}
letterSpacingbooleantrue
lineHeightbooleanfalse
textColumnsbooleanfalse
textDecorationbooleantrue
writingModebooleanfalse
textTransformbooleantrue
dropCapbooleantrue
fontSizesarrayfluid, name, size, slug
fontFamiliesarrayfontFace, fontFamily, name, slug

custom

Generate custom CSS custom properties of the form --wp--custom--{key}--{nested-key}: {value};. camelCased keys are transformed to kebab-case as to follow the CSS property naming schema. Keys at different depth levels are separated by --, so keys should not include -- in the name.


Styles

border

Border styles.

PropertyTypeProps
colorstring, object
radiusstring, object
stylestring, object
widthstring, object
topobjectcolor, style, width
rightobjectcolor, style, width
bottomobjectcolor, style, width
leftobjectcolor, style, width

color

Color styles.

PropertyTypeProps
backgroundstring, object
gradientstring, object
textstring, object

dimensions

Dimensions styles

PropertyTypeProps
aspectRatiostring, object
minHeightstring, object

spacing

Spacing styles.

PropertyTypeProps
blockGapstring, object
marginobjectbottom, left, right, top
paddingobjectbottom, left, right, top

typography

Typography styles.

PropertyTypeProps
fontFamilystring, object
fontSizestring, object
fontStylestring, object
fontWeightstring, object
letterSpacingstring, object
lineHeightstring, object
textColumnsstring
textDecorationstring, object
writingModestring, object
textTransformstring, object

filter

CSS and SVG filter styles.

PropertyTypeProps
duotonestring, object

shadow

Box shadow styles.


outline

Outline styles.

PropertyTypeProps
colorstring, object
offsetstring, object
stylestring, object
widthstring, object

css

Sets custom CSS to apply styling not covered by other theme.json properties.


customTemplates

Additional metadata for custom templates defined in the templates folder.

Type: object.

PropertyDescriptionType
nameFilename, without extension, of the template in the templates folder.string
titleTitle of the template, translatable.string
postTypesList of post types that can use this custom template.array

templateParts

Additional metadata for template parts defined in the parts folder.

Type: object.

PropertyDescriptionType
nameFilename, without extension, of the template in the parts folder.string
titleTitle of the template, translatable.string
areaThe area the template part is used for. Block variations for header and footer values exist and will be used when the area is set to one of those.string

Patterns

An array of pattern slugs to be registered from the Pattern Directory.
Type: array.