The register_block_style function is what you’ll want.
The basic implementation is
register_block_style(
'core/table',
array(
'name' => 'my-table-style',
'label' => 'My Table Style',
)
);
When you select the style, it will add the is-style-my-table-style class to the block, which you can style using your style.css or other stylesheet.
There are two other implementations, where you can declare an inline style or a whole stylesheet for that specific style. You can find more details in the documentation: https://developer.wordpress.org/block-editor/developers/filters/block-filters/#register_block_style
Related Posts:
- use WordPress theme / plugin editor in my plugin
- Passing select control value to block
- Passing RichText attributes to function onChange
- How do I store information in a dynamic block in WordPress?
- How to create custom embed block in gutenberg wordpress
- How to use get_theme_mod in gutenberg editor wordpress?
- How to add Internationalization in WordPress using Javascript/React?
- how to disable blockrenderAppender inside all Innerblocks?
- WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
- Using SVN to upload plugin created with gutenberg blocks
- Gutenberg Block Style CSS Class Is Not Applying on Backend
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Use a custom block in another block
- Gutenberg default attributes are empty when accessing in edit
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- Has blocks gutenberg block multiples registers type in my Plugin
- Fixed: Console.log twice in the edit function
- How to resolve warning for `unstableOnSplit` prop on a DOM element in block editor
- How to dynamically add template in Innerblock?
- Block content rendering on the top just below body tag
- Gutenberg: Dynamic Block – Show saved data in the editor
- Create plugin with multiple blocks
- How do I set register_meta for a specific CPT?
- How do I save meta key value in the save function?
- Update Content for a Custom Block Toolbar Button
- Wrong block appender button showing
- How to get custom setting from get_option and pass it in getEntityRecords in gutenberg block?
- Vanilla javascript in custom gutenberg block not working
- WordPress custom block: Link saved in database not retrieved when editing post
- Why is my Gutenberg block not saving and rendering the chessboard?
- How can we extent core/group or cover block?
- How to change the version of block.js and plugin to the same of Package.json?
- I have to select text from gutenberg editor. Purpose is to store and replace text
- How do I apply different block supports to different parts of my custom block?
- Custom Gutenberg blocks not showing in WP editor
- How to structure a plugin
- Can a developer adopt a plugin marked as “not updated in over 2 years”?
- how to create child WordPress plugin
- dealing with large HTML output via plugin code
- Getting Path To Uploaded Attachment Image After Upload
- Update my custom WordPress Plugin through my own server [duplicate]
- Is There a WordPress Hook to Filter the Edit Posts View?
- Gutenberg: Error loading block: Invalid parameter(s): attributes but it can be used in the code
- Plugin stability | Using a plugin VS Developing functionalities yourself
- WordPress Vote Plugin – Vote Once and Track User
- How to read configuration file in wordpress or PHP
- How do I email a new page password to somebody every month?
- Drag-and-drop “Panels”-style visual layout editor?
- How to Loop Plugin Option Field Set?
- Using the ‘draft_to_publish’ hook (post status transition)
- Show missing Sidebar from Gutenberg admin area
- How to load different css file for different pages
- Gutenberg: How to use output of php render_callback function in the block editors backend?
- Gutenberg: How to use block attributes with ServerSideRenderer?
- Building a scalable WordPress favouriting plugin – one serialised meta value array or many meta records
- Setting up WordPress plugin’s page
- How to test a WordPress plugin through the upgrade automatically feature
- Overrides Plugin Files on WordPress Themes
- How to Create a Directory in a Plugin Folder?
- Declaring script dependencies between scripts enqueued with different action hooks
- Failed to invoke other hook from the init hook
- Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?
- Why is my ajax call refreshing the page?
- Is there an equivalent to Drupal’s Batch API in WordPress?
- Create plugin that works in background
- Checking for user role in a custom plugin
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- HELP: Integrating WP with raw PHP code once published button is hit
- Custom preview_post_link not working for draft post
- How to add custom style to Gutenberg?
- Loading class files via autoload method
- Localize Plugin Description
- Display future posts?
- wp_enqueue_script fails to include in footer
- I would like to use create a function in my custom plugin to tell WP to use a different header
- What is the way to ship read-me strings like plugin-strings for internationalization?
- jQuery function didn’t work in my plugin
- CKEditor: Uncaught TypeError: switchEditors.switchto is not a functiononclick
- Upload file inside plugins options page
- Auto add content such as pages upon plugin activation?
- How to get variables from fucntion.php to my plugin files
- Is there any way to get all the name or slug of template parts used in a page?
- How to make Http Request to a php file present in plugin directory of wordpress
- How to change commenter links to /user/user_id?
- Execute a plugin only on post pages
- What function can I use consistently to escape possible HTML for editing and display?
- First WordPress Plugin – Stat Issues
- Create dynamic page content from custom WordPress plugin page
- Test files for plugin development
- All Users > User List > Update User Meta Field Inline
- Correct way to perform non-cacheable DB query
- Category’s Description field as editor remove tag
- Updating the Drag-To-Share eXtended share URLs?
- Send Custom welcome email to specific user group
- WordPress.org Plugin Directory doesn’t recognise screenshots [closed]
- How to check current user before all actions and filters?
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- WordPress Backend HA (Automatic failover)
- How to Add Custom New Published Post Counter Icon on Top of the WordPress Site [closed]