=== The Icon Block === Contributors: ndiego, outermostdesign Tags: icon, icon block, SVG, SVG block, block Requires at least: 5.8 Tested up to: 5.8 Stable tag: 0.1.2 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html A simple little block that allows you add an SVG icon or graphic to your website. == Description == A simple little block that allows you add an SVG icon or graphic to the Block Editor (Gutenberg). Note that the Icon Block does not include its own icon library (yet). Instead, this plugin allows you to render **any** SVG-based icon by simply copy/pasting the SVG code into the icon textarea! See the screenshots for reference. === Key Features === * Use any SVG icon or graphic * Includes some handy icon controls (link, rotate, alignment, colors, etc.) * No block library required🎉 * Built almost entirely with native WordPress components * Will get additional functionality as its added to WordPress core (margin, borders, responsive controls etc.) === Stay Connected === * [Follow on Twitter](https://twitter.com/theiconblock) * [View on GitHub](https://github.com/ndiego/icon-block) == Installation == 1. You have a couple options: * Go to Plugins → Add New and search for "Icon Block". Once found, click "Install". * Download the Icon Block from wordpress.org and make sure the folder us zipped. Then upload via Plugins → Add New → Upload. * Open the block inserter within the Block Editor (Gutenberg) and search for "icon". The plugin should appear and allow you to it install directly. Skip steps 2 and 3. 2. Activate the plugin through the 'Plugins' screen in WordPress. 3. Search for the block within the Block Editor (Gutenberg) and begin using. == Frequently Asked Questions == = Wait, where are all the icons? = Currently, the Icon Block does not include its own library of icons for users to choose from. If that's what you are looking for, my apologies. The there are many other icon blocks out there that have this functionality. Instead, this plugin allows you to render **any** SVG-based icon by simply copy/pasting the code into the icon textarea! See the screenshots for reference. This gives you complete flexibility and allows you to use practically any icon you want. A great source for free SVG icons is Google's Material Icons project, Font Awesome, and Iconic, just to name a few. = Why is my icon not changing color? = The Icon Block includes controls for the icon's color and background. However, if your SVG icon has hard coded color/fill values, the plugin will respect those instead of any applied custom colors. = Why is the block not working for certain users? = WordPress only allows Administrators and Editors to save SVG content. The Icon Block will not work properly for users who are at the Author level or lower. == Screenshots == 1. Create your own icons by simply copy/pasting the SVG code into the block. Then customize the icon to suit your needs. 2. The Icon Block comes with numerous icon controls such as color, rotation, alignment, padding, and border radius. 3. Whether you need a big icon, or a small one, the Icon Block adapts to your layout. Give it a try with the Row block in Gutenberg! 4. You are not limited to traditional icons. Any SVG-based graphic will work as well. The block will respect any hard coded color/fill values in the provided SVG. == Changelog == = 0.1.2 - 2021-09-27 = **Added** * Added scale transform on the frontend when an icon is linked to improve a11y. This matches the hover styling in the core WordPress Social Icons block. Future improvements are planned, including dedicated hover/focus settings within the block itself. **Fixed** * Fixed translation file. * Fixed version in block.json so block can be added to the Block Directory. = 0.1.1 - 2021-09-25 = **Fixed** * Fixed SVG sanitization for non-standard SVGs. = 0.1.0 - 2021-09-25 = * Initial release🎉
A simple little WordPress block that allows you add an SVG icon or graphic to your website.
Overview
Comments
-
Each child in a list should have a unique "key" prop.
Sometimes I see in console:
Warning: Each child in a list should have a unique "key" prop. Check the top-level render call using <div>. See https://reactjs.org/link/warning-keys for more information. div No<@https://.../wp-content/plugins/icon-block/build/index.js?ver=0084d35570e783e202ca0d63d6e4ecad:2:6239
All maps have keys so I'm stumped why this error would occur. It doesn't seem to break anything.
PS: If it's of interest your plugin works perfectly with WP 6.0 Beta3, I've tested it today.
I updated the description of this issue to remove refereneces to my fork which turned out to be a separate issue & not linked to the missing keys.
Needs Testing -
Retaining styles on custom SVG icons
I've followed your excellent tutorial here to add custom SVG icons but I'm losing the styling as they're designed.
Here is an example:
But it appears in the icon library like this:
Is there any way to retain the styling (colours) of them? I've kept the complete SVG code intact.
-
Customizable icon library
I would love to see a way to manage/customize the icon library. It's the one thing stopping my agency from using this plugin vs. an internally developed one, since we want our clients to be able to select from a library of custom icons and potentially be able to add new ones.
I realize that you can paste custom SVG code, but that only works for admins and might be prone to user error. We would have to maintain some kind of external SVG copy/paste library or put every icon somewhere they could copy/paste from, or even create block variations for every one.
Is this something that might be considered as a potential feature?
enhancement -
Blocks are broken in WordPress 5.8
Thanks for the great plugin.
I put it on WordPress 5.8 and found that when I click on the "Brouse icon Library" button, the block breaks.
Please see:
https://user-images.githubusercontent.com/54422211/152667774-d316a50d-0974-40e0-bdce-5772b8d7dd16.mp4
I think this is because the SearchControl component has not been implemented in WordPress 5.8.
The
SearchControl
component was implemented in Gutenberg 11.1.0, but the version of Gutenberg included in WordPress 5.8 is 10.7.So you might want to replace it with a component such as
bugTextControl
if you will support WordPress 5.8. -
Allow more units for icon width
It would be great if you allowed more units than pixels. I'm a fan of "em" / "rem" so that the width adjusts to current font sizes. Of course it is always easier to use pixel units in a slider, but just allow the values to change in 0.1 steps and also add an input field so that you can really enter all values.
enhancement -
Installing the block from the plugin inserter causes bug in WordPress 5.9
If you install the block from the plugin inserter, the placeholder content does not render correctly. This only appears to happen in WordPress 5.9 without Gutenberg installed. If you refresh the page after installing the plugin, everything looks as it should. With Gutenberg installed, everything appears as it should at all times. While this issue will likely resolve itself with the 6.0 release, we should investigate the source.
Render bug without Gutenberg installed
bug -
Avoid loss of hyphens and colons in attribute names
To fix #3. I ran into the issue and this was the quickest fix I found. I'm not sure why but
html-react-parser
will mangle those attributes and this gets around with a little addition to thereplace
option.I've not tested it extensively but works well for all the icons I've tried so far.
-
Dynamic color var
Hi !
First: thanks for this block, it's really usefull :)
For the bug: When I update my color scheme, icon color aren't updated. It's because you assign the value when saving. So I use the snippet below to force the use of CSS dynamic var, but it's kinda tricky, isn't?
function w_replace_color_value_by_dynamic_color_var( $block_content, $block ) { if ( $block['blockName'] === 'outermost/icon-block' ) { if ( $block['attrs']['iconColor'] !== $block['attrs']['iconColorValue'] ) { $block_content = str_replace( $block['attrs']['iconColorValue'], sprintf('var(--wp--preset--color--%s)', $block['attrs']['iconColor']), $block_content ); } } return $block_content; } add_filter( 'render_block', 'w_replace_color_value_by_dynamic_color_var', 10, 2 );
What do you think about passing color varname to render instead?
enhancement -
The role attribute assigned to the SVG can cause ADA compliance issue
This issue was reported here: https://wordpress.org/support/topic/the-role-attribute-to-svg-cause-ada-compliance-issue/
The role=”img” attribute you give to your inbuilt svg cause ADA compliance issue, for example look at this site ADA result https://siteimprove.com/en-us/accessibility/result/?website=https://valleyfootanklecenter.com/ (see the last error “WAI-ARIA image is missing alternative text”) I think you should either remove role=”img” or provide an input field to add custom area-label attribute value.
-
About accessibility : link label field and aria-hidden="true" option
Hi there!
This block is really great, but not very accessible.
I think it lacks a "label" field when adding a link to the icon to prevent it from being "empty". And it also lacks an option to add the attribute aria-hidden="true" on the whole block when it's about decorative elements.
enhancement -
Update color handling to support Global Styles
Fixes #18
Previously, the icon color and background color were set to a theme's color palette and would not update when the palette was changed. The color hex values were hard coded. This PR keeps the hard-coded color values and adds the relevant CSS classes for the palette colors. The CSS classes override the hard-coded color values. However, if the palette color variable no longer exists, which can occur when switching themes, the hard-coded color values serve as a backup.
enhancement -
Allow users to insert custom SVG icons from an "uploaded" .svg file
Upgrade the placeholder component so that you can drop an .svg file onto the placeholder, and it will automatically insert the custom SVG. This functionality would be similar to the Image block placeholder, but the .svg is not actually uploaded. The SVG is just added to the custom SVG field.
There should also be a way to do this in the custom SVG modal.
enhancement -
Add support for hover colors
Ported from the support forum on WordPress.org
"Could we get hover color options? If we create a link for the icon, it would be nice to have some kind of hover color options for both link and background. Thanks"
enhancement
Releases(v1.4.0)
-
v1.4.0(Jan 3, 2023)
Added
- Added icon height control.
Changed
- Updated WordPress version requirement to 6.0+.
- Updated icon color handling to better support Global Styles.
- Updated icon width control to support additional units.
- Updated settings panel to mirror Core
ToolsPanel
implementations and support setting resets.
Source code(zip)
-
v1.3.2(Oct 18, 2022)
Fixed
- Fix incorrect class specification.
- Fix placeholder background color in prep for WordPress 6.1.
Source code(zip)
-
v1.3.1(Oct 1, 2022)
Fixed
- Fix alignment classes not getting applied in the correct spot.
Source code(zip)
-
v1.3.0(Sep 20, 2022)
Added
- Add the ability to toggle icon color fill. Useful for SVG icons that use stroke.
- Add the ability to disable custom icons using the
iconBlock.enableCustomIcons
filter. - Add title attribute support.
- Add alternative Reddit icon to match WordPress core.
- Add new WordPress icon:
title
Changed
- Update block architecture to support features in WordPress 6.1.
- Update block placeholder to be more consistent with core placeholders.
- Improve support for custom icons without a fill color.
- Improve the UI in various places.
Removed
- Remove deprecated WordPress icons:
archiveTitle
,commentTitle
,postTitle
, andqueryTitle
Fixed
- Fix bug where icon color and fill were overridden by theme colors.
- Fix visual inconsistency between the frontend and Editor due to box-sizing not getting applied in the Editor.
Source code(zip)
-
v1.2.0(May 3, 2022)
Added
- Add alpha support for icon and background colors.
- Add link rel support.
- Add support for custom icon types. Must be registered separately.
- Add new WordPress icons:
post
,postTerms
,queryTitle
,removeSubmenu
, androw
Changed
- Remove deprecated WordPress icons:
alignJustifyAlt
,cogAlt
, andtrashFilled
Source code(zip)
-
v1.1.1(Jan 26, 2022)
Changed
- Include both theme and WordPress default color palettes in the icon and background color picker.
Source code(zip)
icon-block-1.1.1.zip(79.83 KB)
-
v1.1.0(Jan 25, 2022)
Added
- Add additional border support (color, width, style)
- Add margin support
- Add the ability to set an
aria-label
on the icon and link. - Add the core Unlock icon.
- Add the core Comment Author Avatar icon.
- Add the core Comment Author Name icon.
- Add the core Comment Content icon.
- Add the core Comment Edit Link icon.
- Add the core Comment Reply Link icon.
Changed
- Update inserter modal components to use
isFullScreen
to better resemble core modals. - Update styling on inserter modals for improved mobile responsiveness.
- Import the Align None, Color, Reset, and Styles icons directly from @wordpress/icons.
- Remove the custom search component in favor of the core component from @wordpress/components.
- Restructure stylesheets to better conform with block standards.
Fixed
- Fix bug where hyphens and colons would be incorrectly stripped from attribute names in custom icons. Thanks @stokesman for the PR. (#5)
Source code(zip)
icon-block-1.1.0.zip(79.77 KB)
-
v1.0.0(Oct 6, 2021)
Added
- Added the WordPress icon library featuring 270+ icons.
- Add new placeholder and quick icon insertion experience.
- Added new custom icon editing modal for an improved insertion experience.
Source code(zip)
icon-block-1.0.0.zip(70.98 KB)
-
v0.1.0(Sep 25, 2021)
Initial release 🎉
Source code(tar.gz)
Source code(zip)
Spicetify extension to add the icon of a playlist in front of the playlist the playlist list
Spicetify extension to add the icon of a playlist in front of the playlist the playlist list
An easy-to-use jQuery plugin that allows the user to pick an icon from a responsive icon browser and shows the corresponding icon class in an input element.
Font Awesome Browser An easy-to-use jQuery plugin that allows the user to pick an icon from a responsive icon browser and shows the corresponding icon
🍎Transform an SVG icon into multiple themes, and generate React icons,Vue icons,svg icons
IconPark English | 简体中文 Introduction IconPark gives access to more than 2000 high-quality icons, and introduces an interface for customizing your icon
Deploy WordPress plugin and theme to the wordpress.org plugin directory.
wp-deployer Deploy WordPress plugin and theme to the wordpress.org plugin directory. Install npm install --save-dev wp-deployer Settings slug : Plugin
Integrate Tailwind with the @wordpress/create-block script.
Tailwind Blocks Example plugin demonstrating how to integrate Tailwind with the @wordpress/create-block script. The plugin was scaffolded using @wordp
WordPress Gutenberg plugin to display the attributes for the currently selected block in the Document sidebar.
Block X-ray Attributes Stable Tag: 1.2.0 Requires at least: 5.5 Tested up to: 5.9 Requires PHP: 7.2 License: GPL v2 or later Tags: block attributes, g
An experimental plugin to preview and insert block patterns in WordPress.
Block Pattern Explorer The Block Pattern Explorer is an experimental WordPress plugin based heavily on the work currently being done in Gutenberg. The
Theme Redone is a custom WordPress theme starter/framework with its own Gutenberg blocks solution and a CLI that speeds up the block creation process.
Theme Redone The Framework for Developing Custom WordPress Themes with its own Gutenberg Blocks creation solution. Theme Redone is a custom WordPress
svg react icons of popular icon packs
React Icons Include popular icons in your React projects easily with react-icons, which utilizes ES6 imports that allows you to include only the icons
Pebble - A free funky formalicious icon set for React (& plain ol' SVG & PNG)
A free funky formalicious icon set for React (& plain ol' SVG & PNG) Pebble is an icon set that aims for a friendly character. There's no real
"To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to mark them as complete. You will build a simple website that allows for doing that, and you will do it using ES6 and Webpack!
To-do-list Description "To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to mark t
A block preview that directly displays the block fields, including tabs.
Kirby Block Preview Fields This plugin for Kirby 3 displays the block fields directly in the block preview, including tabs. Inspired by the Kirby Fiel
Help Ukraine - add ribbon with Ukraine flag into the website you manage, show the anti-war message to Russian users, or block them from your service.
?? Stop war on Ukraine ?? Help Ukraine - add ribbon with Ukraine flag into the website you manage, show the anti-war message to Russian users, or bloc
Add a super simple rotating text to your website with little to no markup
#Super Simple Text Rotator by Pete R. A light weight jQuery plugin that will allow you to add a super simple rotating text to your website with little
Ossama Mehmood (ossamamehmood.me) 🚀 Digital Creator / 🎗️ Graphic Designer / 🔮 User Interface (UI) & Experience (UX)
Ossama Mehmood 샘 (ossamamehmood.me) Greetings..! I'm Ossama Mehmood DIGITAL CREATOR OSSAMAMEHMOOD Home About me Skills Resume Testimonials Portfolio C
A lightweight graphic library providing 2d draw for Apache ECharts
ZRender A lightweight graphic library which provides 2d draw for Apache ECharts. Documentation https://ecomfe.github.io/zrender-doc/public/ License BS
Merge multiple JSON files - Vanilla JavaScript and HTML (graphic mode: browser+explorer)
JSON Merger Usage First, git clone project git clone https://github.com/mtacnet/json-merger.git Move to cloned repository and open generate.html with
Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan with <3
Gutpress(WordPress Gutenburg Block Plugin) Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan w
"Awesome books" is a simple website that displays a list of books and allows you to add ang remove books from that list. Also you can store your data in your local storage. Build with JavaScript, HTML and CSS.
Awesome Books Creating an app that adds and delete books from a list. Built With HTML CSS JavaScript Application Page url https://TimmyChan99.github.i
Spicetify extension to add the icon of a playlist in front of the playlist the playlist list
Spicetify extension to add the icon of a playlist in front of the playlist the playlist list