Using theme.json settings in your custom Gutenberg blocks

Utilizing the theme.json file for customizing your WordPress site is a powerful way to enhance the user experience for those managing content within Gutenberg. We can access these settings within our custom gutenberg blocks by utilizing the “useSetting” function available within “@wordpress/block-editor”.

Below is an example of how to utilize the color palette defined in our theme.json file for the ColorPalette component within a custom block:

Exit mobile version