Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgefilipecosta/2f1278238eb9adbfe8d5dd00cddb3630 to your computer and use it in GitHub Desktop.
Save jorgefilipecosta/2f1278238eb9adbfe8d5dd00cddb3630 to your computer and use it in GitHub Desktop.
exampleTextControl.js
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InspectorControls = wp.blockEditor.InspectorControls;
var TextControl = wp.components.TextControl;
registerBlockType( 'test/block', {
title: 'Test Block',
icon: 'cart',
category: 'common',
edit: function() {
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } },
'Text Block',
el(
InspectorControls,
{},
el(
TextControl,
{
label: 'test input',
help: 'test help',
type: 'text',
defaultValue: 'Default Value',
}
)
)
);
},
save: function() {
return null;
},
} );
} )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment