I think the most simple approach (if you’re able to add some JS) is to use custom classes for your buttons and blocks that can be settled through advanced settings in block editor. Then a really basic JS snippet can do the trick.
Here’s an example in vanilla JS with an IFFE that takes care of waiting for DOM to be loaded : https://codepen.io/liqueurdetoile/pen/dyjEYEP
Obviously class names have to be chosen wisely to avoid any trouble.
EDIT – You can also use any accordion block for Gutenberg to achieve a similar result. There’s plenty available as plugins.
Related Posts:
- Shortcode to Gutenberg-block: additional text on front-end and conditional display
- Enqueue Scripts / Styles when shortcode is present
- How to save a shortcode in a Gutenberg custom block?
- Alternate text if shortcode returns no data
- gutenberg widget outputting paragraph marks
- is_admin() returns false in save_post hook with Gutenberg editor
- Wrap shortcode inside custom block
- Instagram URL is converted into oEmbed
- Gutenberg Block with Select from JSON-File
- add action only if gallery shortcode attribute is equal to?
- How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
- Adding a template part as part of a shortcode
- Gutenberg Shortcode Fail
- If else with shortcodes
- Gutenberg Shortcode Chooser Block
- Gutenberg Shortcode will turn html to html entity
- Gutenberg running code only available in front end within shortcode
- Shortcode, vs blocks, vs templates – what would you do for choosing or creating custom post data in editor?
- How to use code in an editor block?
- How can I remove the wp_autop filter from a shortcode block in a block theme page template (twenty twenty-three)?
- how to show the syntax of a shortcode
- Get first video from the post (both embed and video shortcodes)
- shortcode outputs first before the page content [duplicate]
- Shortcode attribute value with dash (hyphen)
- Shortcode content does not show in feed discription/excerpt
- Adding shortcode inside Visual Composer raw HTML [closed]
- Shortcode not working inside html input
- do_shortcode based on _thumbnail_id
- Why does WP not like my container?
- How to link to a alternative page in CSS
- How to handle a shortcode function directly?
- Turn a snippet of HTML and PHP into a shortcode
- How can I get the current user email instead of user ID?
- How to put an “include” inside a “do_shortcode”?
- Shortcodes output in the wrong order
- Should I cache default WordPress gallery shortcode output?
- WordPress 4.7 Galery shortcode not working
- How to add and submit input fields using a shortcode?
- How can i remove the paragraph from shortcodes content?
- Pass javascript array to shortcode
- WordPress shortcode display as plain text
- Replace / Remove Shortcode after 1st run / post
- Duplicating Table of Contents for Paginated Post
- WordPress Shortcode callback function with a plugin
- Can I wrap an unordered list inside a shortcode?
- Conditional Shortcode image display
- WordPress shortcode for a section Template
- Saving post content to database with do_shortcode?
- Is it important to sanitize inputs in a shortcode that will be used in site that only I will post to?
- Single post content custom order
- Adding a class to shortcode API
- Parse Error: unexpected ‘}’ while creating Shortcode with Loop [closed]
- Code is providing a row of data but not formatting it as table
- Forcing WP to embedd a video when using a shortcode
- Shortcode for output of wp_get_archives displays at top of post
- How can I execute shortcode outside the loop?
- Shortcode is not returned correctly
- passing markup thought a shortcode attribute
- How to have shortcode autofilling the content if the attribution is specified?
- Shortcode argument multiple values
- Do I need to escape number in this shortcode function?
- How can I list only custom shortcodes?
- Substite Category Slug in a Shortcode
- add new attributes into existing shortcodes
- Anchor text in Short code →
- Need 2 separate elements of add_shortcode for presentation
- Why ‘do_shortcode’ doesn’t work in a REST request?
- Shortcode to return an image based on post taxonomy
- How to show an image via shortcode
- How to put custom admin setting field into a shortcode
- shortcode – I need to throw a message or load a different page
- How to add site tags in alphabetical order to shortcode?
- WordPress post shortcode pagination not working
- Shortcode do not return a value
- How to use multiple (or array) values in $content of shortcode?
- How to display content if user meta data isn’t empty with shortcode
- How to display total user count by specific role in WordPress as statistics?
- How to style inline code in block editor?
- Is it possible to capture the content outside/between shortcodes?
- Add Style to text in a PHP block
- How to add new images to existing shortcode configuration?
- Content included from pagination
- How to completely prevent WordPress from destroying/modifying my shortcode outputs?
- Is it inefficient to repeat a Shortcode 100 times on a page?
- tinymce custom button
- Running Filter or Shortcode Before Query Prevents Excerpt from Showing
- Replace custom gallery shortcode with default gallery shortcode
- WordPress Payment link will not transform PHP vars into values
- Referring to site URL in shortcode argument
- How WordPress Displaying Shortcode In Post Content?
- Shortcode not accepting atts
- the_time function inside HTML dom parser
- Code auto escaping is not working when using short codes
- Shortcodes: Return different based on atts
- wp_register_script and wp_register_style when shortcode is used
- Good example of a short code +4346? [closed]
- How can I hide the ACF shortcode when empty
- How to pass text input data to shortcode
- Using variable as shortcode parameter
- How to handle Ajax Calls, when using same shortcodes (with different parameters, e.g. ‘post-type’)?