A category to store your BuddyPress blocks

Dear BuddyPress block developers,

We thought about you! As the BP REST API will be included into our next major release (5.0.0), it will open up new opportunities to create great features and of course BuddyPress blocks. To make things obvious for our end users, what about storing them into the BuddyPress blocks category we’ve just added to BuddyPress Core (See changeset #12418) ?

Screenshot of the Block selector

To do so, when registering your block type, you’ll just need to set the category property of your block to buddypress. Here’s an example below.

( function( blocks, element ) {
    var el = element.createElement;

    blocks.registerBlockType( 'bpeb/example-block', {
        title: 'BuddyPress example block',
        description: 'A BuddyPress example block to show how to be listed into the BuddyPress blocks category.',
        icon: 'buddicons-groups',
        category: 'buddypress',
        edit: function() {
            return el(
                'p',
                {},
                'BuddyPress blocks are stored into the BuddyPress blocks category.'
            );
        },
        save: function() {
            return el(
                'p',
                {},
                'BuddyPress blocks are stored into the BuddyPress blocks category.'
            );
        },
    } );
}(
    window.wp.blocks,
    window.wp.element
) );

Get the BuddyPress Example Block from Gist.GitHub | Block Editor Handbook

NB: This category will be available as soon as 5.0.0 will be released.

😉 👋

#5-0-0