A simple little WordPress block that allows you add an SVG icon or graphic to your website.

Overview
=== 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 
  
  
  🎉
 
 
 
Comments
  • Each child in a list should have a unique

    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 
    opened by EdithAllison 4
  • Retaining styles on custom SVG icons

    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:

    Screenshot_9

    But it appears in the icon library like this:

    Screenshot_11

    Is there any way to retain the styling (colours) of them? I've kept the complete SVG code intact.

    opened by zigojacko 3
  • Customizable icon library

    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 
    opened by cr0ybot 3
  • Blocks are broken in WordPress 5.8

    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 TextControl if you will support WordPress 5.8.

    bug 
    opened by t-hamano 3
  • Allow more units for icon width

    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 
    opened by Jugibur 2
  • Installing the block from the plugin inserter causes bug in WordPress 5.9

    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 image

    bug 
    opened by ndiego 2
  • Avoid loss of hyphens and colons in attribute names

    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 the replace option.

    I've not tested it extensively but works well for all the icons I've tried so far.

    opened by stokesman 2
  • Dynamic color var

    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 
    opened by willybahuaud 1
  • The role attribute assigned to the SVG can cause ADA compliance issue

    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.

    bug 
    opened by ndiego 1
  • About accessibility : link label field and aria-hidden=

    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 
    opened by alexandrebuffet 1
  • Update color handling to support Global Styles

    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.

    icon-block-styles

    enhancement 
    opened by ndiego 0
  • Allow users to insert custom SVG icons from an

    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.

    upload

    There should also be a way to do this in the custom SVG modal.

    enhancement 
    opened by ndiego 1
  • Add support for hover colors

    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 
    opened by ndiego 0
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(tar.gz)
    Source code(zip)
  • v1.3.2(Oct 18, 2022)

  • v1.3.1(Oct 1, 2022)

  • 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, and queryTitle

    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(tar.gz)
    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, and row

    Changed

    • Remove deprecated WordPress icons: alignJustifyAlt, cogAlt, and trashFilled
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Jan 26, 2022)

  • 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(tar.gz)
    Source code(zip)
    icon-block-1.1.0.zip(79.77 KB)
  • v1.0.0(Oct 6, 2021)

  • v0.1.0(Sep 25, 2021)

Owner
Nick Diego
WordPress Developer — @FrostWP ❄️ Block Visibility · The Icon Block ⚡️
Nick Diego
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

Jeroen 22 Dec 20, 2022
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

Gianluca Chiarani 1 May 1, 2021
🍎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

Bytedance Inc. 6.8k Jan 5, 2023
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

Nilambar Sharma 5 Sep 6, 2022
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

David Gwyer 25 Nov 13, 2022
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

Sal Ferrarello 38 Mar 18, 2022
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

WP Engine 16 Oct 19, 2022
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

null 103 Dec 30, 2022
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

null 9k Jan 1, 2023
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

Max Steenbergen 12 Nov 19, 2022
Cindy Dorantes 12 Oct 18, 2022
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

JUNO 8 May 10, 2023
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

Pavol Hejný 46 Jan 7, 2023
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

Pete R. 754 Dec 6, 2022
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

Ossama Mehmood 샘 2 Jun 17, 2022
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

Baidu EFE team 5.5k Dec 30, 2022
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

Tac 1 Sep 18, 2022
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

Arif Khan 4 Nov 23, 2022
"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

Fatima Ezzahra elmenoun 5 Jan 28, 2022
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

Jeroen 22 Dec 20, 2022