@wordpress/block-library
Version:
Block library for the WordPress editor.
43 lines (42 loc) • 1.25 kB
JavaScript
import { __, sprintf } from "@wordpress/i18n";
import { tabs } from "@wordpress/icons";
import initBlock from "../utils/init-block.mjs";
import edit from "./edit.mjs";
import save from "./save.mjs";
import metadata from "./block.json";
// packages/block-library/src/tabs/index.js
const { name } = metadata;
const settings = {
icon: tabs,
example: { innerBlocks: [{
name: "core/tab-list",
attributes: { tabs: [{ label: __("Tab 1") }, { label: __("Tab 2") }] }
}, {
name: "core/tab-panels",
innerBlocks: [1, 2].map((index) => ({
name: "core/tab-panel",
attributes: {
anchor: `tab-${index}`,
label: sprintf(
/** translators: %s: tab index number */
__("Tab %s"),
index
)
},
innerBlocks: [{
name: "core/paragraph",
attributes: { content: __("In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.") }
}]
}))
}] },
template: [["core/tab-list"], ["core/tab-panels"]],
edit,
save
};
const init = () => initBlock({
name,
metadata,
settings
});
export { init, metadata, name, settings };
//# sourceMappingURL=index.mjs.map