-
{ title }
diff --git a/packages/block-library/src/tabs/block.json b/packages/block-library/src/tabs/block.json
index b3bc49af3ea06..154ba0e9e6ada 100644
--- a/packages/block-library/src/tabs/block.json
+++ b/packages/block-library/src/tabs/block.json
@@ -8,10 +8,19 @@
"textdomain": "default",
"__experimental": true,
"allowedBlocks": [ "core/tab" ],
- "attributes": {},
+ "attributes": {
+ "activeTab": {
+ "type": "number",
+ "default": 0
+ }
+ },
+ "providesContext": {
+ "tabs/activeTab": "activeTab"
+ },
"supports": {
"align": [ "wide", "full" ],
"html": false,
+ "interactivity": true,
"layout": {
"default": { "type": "flex", "orientation": "horizontal" },
"allowSwitching": false,
@@ -23,6 +32,6 @@
"padding": true
}
},
- "editorScript": "file:./build/index.js",
- "style": "file:./build/style.css"
+ "editorStyle": "wp-block-tabs-editor",
+ "style": "wp-block-tabs"
}
diff --git a/packages/block-library/src/tabs/edit.js b/packages/block-library/src/tabs/edit.js
index 25fc9b40db6a1..481479b15f055 100644
--- a/packages/block-library/src/tabs/edit.js
+++ b/packages/block-library/src/tabs/edit.js
@@ -1,12 +1,46 @@
/**
* WordPress dependencies
*/
-import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
+import {
+ InnerBlocks,
+ useBlockProps,
+ useInnerBlocksProps,
+ store as blockEditorStore,
+} from '@wordpress/block-editor';
+import { useSelect } from '@wordpress/data';
+import { __ } from '@wordpress/i18n';
+import { useState } from '@wordpress/element';
+import clsx from 'clsx';
+
+export default function Edit( { attributes, clientId, setAttributes } ) {
+ const { activeTab } = attributes;
+ const innerBlocks = useSelect(
+ ( select ) => select( blockEditorStore ).getBlocks( clientId ),
+ [ clientId ]
+ );
+
+ const setActiveTab = ( index ) => {
+ setAttributes( { activeTab: index } );
+ };
-export default function Edit() {
return (
-
-
+
+
+ { innerBlocks.map( ( block, index ) => (
+
+ ) ) }
+
+
+
+
);
}