Is it possible to create column width presets in Gutenberg?

Gutenberg gives you some good choices out of the box but is it possible to add a custom preset? I understand I can change the columns manually but was hoping for a preset to make it easier on the client. My other thought was just manually change the 70/30 one to be more 80/20 in the CSS but again for lack of a better option. Any options as far as adding a preset?

Topic block-editor columns Wordpress

Category Web


Just in case anyone else comes looking here's what I did. First I enqueued a javascript file into the block editor.

add_action( 'enqueue_block_editor_assets', function () {
    wp_enqueue_style( 'block-editor-styles',  get_template_directory_uri('styles/gutenberg.css'), false, '1.0', 'all' );
    wp_enqueue_script( 'block-editor-scripts', get_template_directory_uri('scripts/gutenberg.js'), array( 'wp-blocks', 'wp-dom' ), time(), true );
});

Then I just used this bit of code for adding a column variation.

wp.domReady( function () {
  wp.blocks.registerBlockVariation(
    'core/columns', {
     name: 'two-columns-two-thirds-one-third-eighty-twenty',
     title: '80/20',
     description: 'Two columns; two-thirds, one-third split',
     icon: '<svg />',
     innerBlocks: [
        ['core/column', { width: '80%' }],
        ['core/column', { width: '20%' }],
     ],
     scope: ['block'],
    }
  );
});

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.