Our.Iconic.Core
3.1.1-pre001
See the version list below for details.
dotnet add package Our.Iconic.Core --version 3.1.1-pre001
NuGet\Install-Package Our.Iconic.Core -Version 3.1.1-pre001
<PackageReference Include="Our.Iconic.Core" Version="3.1.1-pre001" />
paket add Our.Iconic.Core --version 3.1.1-pre001
#r "nuget: Our.Iconic.Core, 3.1.1-pre001"
// Install Our.Iconic.Core as a Cake Addin #addin nuget:?package=Our.Iconic.Core&version=3.1.1-pre001&prerelease // Install Our.Iconic.Core as a Cake Tool #tool nuget:?package=Our.Iconic.Core&version=3.1.1-pre001&prerelease
Iconic
Highly configurable icon picker for Umbraco.
Introduction
With Iconic you will be able to create a property editor that can use virtually any font package out there and not only that, you will be able to select your icon from more than one package on the same property.
Installation
Use V3 for Umbraco 8 & 9\
Previous versions of this package are on https://github.com/Skartknet/Iconic Use V2 for Umbraco 8 Use V1 for Umbraco 7
Umbraco Package
https://our.umbraco.com/packages/backoffice-extensions/iconic/
Configuration
Once the plugin is installed is time to configure it to your needs.
Create a new DataType
You have to create a new datatype from the Iconic editor:
- Go to the Developer section.
- Right click on DataTypes, click Create and click on New data type.
- Enter a name for your datatype and select Iconic from the Property Editor dropdown.
<img src="Documentation/datatype.png" width="600" alt="Create datatype" >
At this point I would recommend you to save your datatype as the configuration can take a bit of trial an error as you will need to deal with some regex and urls.
Iconic Configuration
On the Packages Configuration property, click the Add button. This will display a new form that you will use to configure your new font package.
Enter the name for your package
Create your selector. This will use regex to extract your icons css from the font package.
Source file path. This file will contains the specific configuration for each icon. To extract the rules the previous regex rule will be used. This file will normally be a CSS file where the rules are contained. You can use absolute or relative paths. See below.
Path to your font package css file.
- You can use absolute paths: http:\www.yoursite.com\sytles\fonts\my-font-package.css. This allows you to use external files, like the ones from a CDN.
- Or relative to the root: \styles\fonts\my-font-package.css This file will be loaded in the head of your backoffice and will affect the whole view so be careful of what you load there. Check the Known Issues section for some more info.
Template. This will be the template your icon will be based on. You can use the value
{icon}
as placeholder for your icon specific rule. For instance, for Font Awesome you should enter something like:<i class="fa {icon}"></i>
Override Backoffice template. Optional. You can override the Template value to use differente templates for frontend and backoffice.
Click Add Package to add the configuration to your packages listing. Before adding the package, Iconic will extract the css rules from the file using the regex selector. Some checking is ran that will let you know if something went wrong with your configuration.
Template Placeholders
You can use the following placeholders to customize the way your icon is rendered in the frontend:
- {icon} : Here is where the specific icon rule will be included. For instance, for a Font Awesome icon you would do
<i class="fa {icon}"></i>
- {classes}: You can add extra classes to your icon from your views. See Displaying the Icon
- {attributes}: You can use this placehoder to add extra attributes to your icon from your views. This can be useful to add data attributes for instance amongst other things. See Displaying the Icon
Icons source file
This file will be used to extract the specific configuration for each different icon.
For example, some packages like Font Awesome use css rules to apply the specific icon:
<i class="fa fa-glass"></i> (Template: <i class="fa {icon}"></i>)
Other packages like Material Icons use the glyph codes or even ligatures to display the icon instead of a specific css selector.
<i class="material-icons">alarm</i> (Template: <i class="material-icons">{icon}</i>)
So this file can be the same css file or another files used to extract the icons property. In the case of Material Icons for instance there is a file called <a href="iconfont/codepoints">codepoints</a> where you can extract the icons names from.
Material Icons
If you're having issues configuring Material Icons, try this configuration:
Css File: https://fonts.googleapis.com/icon?family=Material+Icons
Rules file: https://github.com/mattecapu/md-icons-codepoints
Font Awesome 5
The version 5 is a bit tricky to configure. There is a <a href="https://www.edg3.co.uk/blog/how-to-add-font-awesome-v5-icons-using-iconic-in-umbraco/">great post</a> about it, thanks to Christopher Robinson.
Icon Preview (V3)
If everything is configured properly, and Iconic can extract a list of your icons, you will be able to preview your configured Template. Click the Reload Preview button and you should get a preview of the first icon found on your source file.
Cool tip: you can preview changes to your template in real time (no need to click Reload preview) 💥.
<img src="Documentation/icon-preview.png" width="600" alt="Icon preview" />
Pre configured packages
To make your life easier I have included some help to configure your packages in the form of pre-configured packages. If you select Pre-Configured when creating your package, you will have access to a list of pre-configured ones. You will still have to enter your css file path.
<img src="Documentation/addPreConfig.png" width="600" alt="Pre-configured package" />
You can add as many packages you like. You can also arrange their order or remove those you don't want to use anymore.
Note: the regex included in the preconfigs are valid for the minimised versions of them.
Reviewing your configuration
Once you have added your configuration, this will be added to the configurations list. You add add as many as you want. To review the details of your configured package just click on them:
<img src="Documentation/configDetails.png" width="600" alt="See configuration details" >
You will get a read-only list of your values. To edit them just click on the Edit Package option.
Using the DataType
Once you have configured your datatype, you can use it as a property editor.
<img src="Documentation/select-editor.png" width="300" alt="Create property" >
To add or modify your icon just click on the placeholder, this will open a dialog where you can select form your configured packages. Once a package is selected, all the icons will be displayed below. <img src="Documentation/using-iconic.png" width="600" alt="Using Iconic" >
<a name="displaying"></a> Displaying the icon
Iconic comes with a value converter that will return a HtmlString containing the icon html. So you just have to use the model of your template like so:
@Html.Raw(Model.MyIcon)
Remember to wrap the icon in Html.Raw so Razor displays the returned html properly.
There is a second way of rendering your icon that allow you to add extra classes and attributes from your views. Remember that you need to add the placeholders on the right place of your template when you confgiure Iconic.<br>
IHtmlString RenderIcon(this HtmlHelper helper, IHtmlString icon, object htmlAttributes, params string[] extraClasses)
For this extension to work you'll have to include @using Iconic.Helpers
on your view.
Example: @Html.RenderIcon(Model.MyIcon, "dataX='mydata'", "myclass")
If you had a template like <i class="fa {icon} {classes} fa-5x" {attributes}></i>
This will render to:
<i class="fa fa-power-off myclass fa-5x" data-x="mydata"></i>
Note that to render data-x
you have to enter dataX
as your attribute name.
Known issues
Stacked Content
If you are using stacked content and Iconic, you must ensure that any stacked document types do not use "icon" as the alias for an Icon Picker property editor. It's a known issue of Inner Content: <a href="https://github.com/umco/umbraco-inner-content#known-issues">https://github.com/umco/umbraco-inner-content#known-issues</a>
Glyphicons
If you try to use Glyphicons as part of the Bootstrap package, you will realise that the whole css file will be loaded on your backoffice. This might break some of the backoffice functionality, i.e. buttons or the grid editor. To avoid this you should export the Glyphicons classes into their own separate file. You can do this from this link and select only Glyphicons from the Components section.
Font Awesome Pro
Currently if you are using font awesome pro and stacked content, icons will not render correctly in stacked content preview
Handmade by Mario Lopez - 2018 @OurDigital
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- UmbracoCms.Core (>= 8.15.0)
- UmbracoCms.Web (>= 8.15.0)
-
net5.0
- Umbraco.Cms.Web.Common (>= 9.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Our.Iconic.Core:
Package | Downloads |
---|---|
Our.Iconic
Highly configurable icon picker for Umbraco. With Iconic you will be able to create a property editor that can use virtually any font package out there and not only that, you will be able to select your icon from more than one package on the same property. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
14.0.0-beta2 | 65 | 9/27/2024 |
14.0.0-beat1 | 70 | 9/27/2024 |
12.0.0 | 47,069 | 2/26/2024 |
5.3.0 | 45,516 | 6/28/2023 |
5.2.0 | 22,978 | 2/5/2023 |
5.2.0-beta3 | 1,507 | 12/6/2022 |
5.1.0-beta1 | 184 | 11/28/2022 |
5.0.0 | 3,806 | 11/4/2022 |
3.2.0 | 22,602 | 7/23/2022 |
3.1.2 | 10,197 | 1/22/2022 |
3.1.1 | 1,142 | 12/31/2021 |
3.1.1-pre001 | 931 | 12/26/2021 |
Now multi-targeting Umbraco 8 and 9