Support

Account

Home Forums Gutenberg Adding Block Styles to an ACF Custom Block Reply To: Adding Block Styles to an ACF Custom Block

  • You can add styles directly via the acf_register_block_type() function like so:

    acf_register_block_type( [
    	'name'			=> '',
    	'title'			=> '',
    	'description'  	=> '',
    	'render_callback' => '',
    	'category'		=> 'formatting',
    	'icon'			=> '',
    	'mode'			=> '',
    	'keywords'		=> [],
    	'supports'      => [],
    	'styles'  => [
    		[
    			'name' => 'light',
    			'label' => __('Light', 'abc'),
    			'isDefault' => true,
    		],
    		[
    			'name' => 'medium',
    			'label' => __('Medium', 'abc'),
    		],
    		[
    			'name' => 'dark',
    			'label' => __('Dark', 'abc'),
    		]
    	],
    ]);