Replies: 5 comments 2 replies
-
Hi. import { useSetting } from '@wordpress/block-editor';
const fontSizes = useSetting( 'typography.fontSizes' ) |
Beta Was this translation helpful? Give feedback.
-
Weird, it's breaking the block and throwing this console error: |
Beta Was this translation helpful? Give feedback.
-
and then add it though wp_localize_script() |
Beta Was this translation helpful? Give feedback.
-
import { useSelect } from '@wordpress/data'; const { fontSizes } = useSelect( ( select ) => { |
Beta Was this translation helpful? Give feedback.
-
import { FontSizePicker } from '@wordpress/components';
import { useSetting } from '@wordpress/block-editor';
const fontSizes = useSetting('typography.fontSizes'); // gets the font data from theme.json
<FontSizePicker
fontSizes={fontSizes}
...
/> |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Does anyone know of a way to get theme.json information to use as options for components like FontSizePicker and SelectControl?
In the example below, instead of hardcoding the values under fontSizes, I want to be able to feed in the theme's font sizes (if any exist).
Beta Was this translation helpful? Give feedback.
All reactions