HM Block Gradient Border
Gradient border style control for WordPress core blocks
by Human Made · github.com/humanmade/hm-block-gradient-border · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/humanmade/hm-block-gradient-border/archive/refs/heads/main.zipReadme
HM Block Gradient Border
Adds a gradient border style control to the WordPress block editor. Works with any theme that supplies gradient presets in theme.json.
Features
- Adds a Gradient Border panel to the block inspector (Styles tab) for supported blocks.
- Applies
is-style-gradient-borderclass when a gradient is selected; removes it when cleared. - Injects
--border-gradientand--border-widthCSS custom properties server-side so the frontend renders without a flash of un-styled content. - Supported blocks (default):
core/columns,core/column,core/group,core/image,core/cover,core/media-text,core/post-terms,core/query-title. - Extend the supported block list with the
hm-block-gradient-border.supportedBlocksJavaScript filter.
Installation
- Download the latest release ZIP.
- Upload to
wp-content/plugins/or install via Plugins → Add New → Upload Plugin. - Activate the plugin.
Or via Composer:
composer require humanmade/hm-block-gradient-border
Extending supported blocks
Add more blocks before this plugin's JS loads:
wp.hooks.addFilter(
'hm-block-gradient-border.supportedBlocks',
'my-plugin/extend-gradient-border',
( blocks ) => [ ...blocks, 'core/heading' ]
);
Architecture
src/index.js— Editor extension: registers theborderGradientattribute and renders theGradientPickerpanel viaeditor.BlockEditandblocks.registerBlockTypefilters.src/view.scss— Frontend CSS:.is-style-gradient-border::afterwithmask-composite: excludeto draw the gradient ring.inc/render.php—render_blockfilter (priority 10): stamps--border-gradientand--border-widthonto the element's inline style.
Developer workflow
npm install
npm run build # production build
npm run start # watch mode
npm run lint:js # lint JavaScript
npm run lint:css # lint CSS
npm run playground:start # start WordPress Playground at http://127.0.0.1:9400
npm run test:e2e # run Playwright tests
Release workflow
See RELEASE.md.