sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Using UI Fabric Icons for ListView Commands

Open thechriskent opened this issue 9 years ago • 16 comments

Category

  • [X] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

In addition to the iconImageUrl property for commands, an implementation of the officeFabricIconFontName property that would match the functionality of the same property for client-side web parts and allow the specification of a UI Fabric icon class name.

Currently, the iconImageUrl property generates this markup when located in the Toolbar:

<span class="CommandBarItem-icon">
  <i class="ms-Icon ms-Icon--custom" data-bind="style: { backgroundImage: 'url(\'' + $parent.iconUrl() + '\')' }" style="background-image: url(&quot;icons/request.png&quot;);"></i>
</span>

The proposed officeFabricIconFontName property with a value of "Emoji2" could generate something similar to this:

<span class="CommandBarItem-icon ms-Icon ms-Icon--Emoji2"></span>

Here's how that might look (I've replaced the generated markup with the proposed markup on the page directly): CommandBar officeFabricIconFontName

For reference, here is the definition of the officeFabricIconFontName property from the client-side-web-part manifest.schema.json:

"officeFabricIconFontName": {
  "title": "Office Fabric Icon Name",
  "description": " The icon for the Web Part, to be displayed in the toolbox, represented as a character name in the Office 365 icon font file. The icon font is specified here: http://o365icons.cloudapp.net/. If this field has a value, the 'iconImageUrl' field will be ignored.",
  "type": "string",
  "minLength": 1
},

thechriskent avatar Jun 13 '17 13:06 thechriskent

Hi, I am getting this error:

Error - [write-manifests] Manifest validation error (./src/extensions/helloWorld/HelloWorldCommandSet.manifest.json): (#/) Data does not match any schemas from 'oneOf' (#/) Missing required property: description (#/) Additional properties not allowed: items (#/componentType) No enum match for: Extension (#/) Missing required property: preconfiguredEntries (#/items/COMMAND_2) Additional properties not allowed: officeFabricIconFontName (#/) Missing required property: rootComponentId

My manifest code as below:

"COMMAND_2": { "title": { "default": "Command Two" }, "iconImageUrl": "icons/cancel.png", "officeFabricIconFontName": { "title": "Emoji2", "description": "Testing", "type": "string", "minLength": 1 }, "type": "command" }

Can you please share a working code example how to change the command set icon by using office fabric icon?

Thanks.

johnthen avatar Oct 24 '17 03:10 johnthen

ribbon-button

This is a comparison of the render'ed HTML - for a OOTB button - vs. a custom embedded set. I would expect that the manifest.json can thus allow the following :

"items": { "MCD_CMD": { "title": { "default": "MCD" }, "icon": "Emoji2", "type": "command" }

But - this has an error - doesn't match the schema : https://dev.office.com/json-schemas/spfx/command-set-extension-manifest.schema.json

*** What schema do the OOTB commands use ??

GrumpyWookie avatar Nov 14 '17 03:11 GrumpyWookie

So, is this a current limitation with SPFx command extensions? Would prefer to link back to Fabric Icons instead of creating new ones.

AsishP avatar Nov 14 '17 23:11 AsishP

That's indeed a current limitation of extensions. @VesaJuvonen should it be logged as a new feature on UserVoice or is it keeping it as an issue here sufficient?

waldekmastykarz avatar Nov 29 '17 13:11 waldekmastykarz

Reading the first article from @thechriskent, seems like this is already implemented? Or that part is for something else?

AsishP avatar Nov 29 '17 23:11 AsishP

@AsishP - that part is a suggestion for @thechriskent towards us in SP engineering on how it should work... but it has not been implemented. I'd suggest to create a UserVoice entry for this and until that's available, different supported options are presented in following article: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/basics/configure-extension-icon.

VesaJuvonen avatar Nov 30 '17 07:11 VesaJuvonen

@AsishP sorry for the confusion! The above screenshots were made my manipulating the DOM to show what I thought it might look like.

Not sure why I never submitted this as a UserVoice entry, but it looks like Alex Terentiev did on October 5th: https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/31781332-allow-to-use-office-ui-fabric-icons-and-other-font

Go give that entry a vote!

thechriskent avatar Nov 30 '17 12:11 thechriskent

Thanks @VesaJuvonen and @thechriskent. I have voted for this user voice. Something out of this thread, could you please also provide some guidance on the below. Don't know if I should submit new voice or they are threads on these.

  1. Grouping of multiple commands on Command Bar as done by the 'New' command. I can see an example here - https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries#user-custom-actions, but don't know how does it link to SPFx extensions
  2. Listview route refresh after an update is done to a record using SPFx extension. Currently I am refreshing the whole page which is not a good flow.
  3. BaseDialog 'isBlocking' IDialogConfiguration override is not working. This seems to be a bug to me but may be something I am doing wrong (Following this example - https://github.com/SharePoint/sp-dev-docs/blob/master/docs/spfx/extensions/guidance/using-custom-dialogs-with-spfx.md)

AsishP avatar Nov 30 '17 22:11 AsishP

hi @AsishP - since follow up questions are not really related on the Office UI Fabric usage, would suggest to open up a new Issue for those, so that they are tracked separately and they will not get hidden in issue with different subject/title.

In sort rules are following - if you have a question, feel free to ask that on this issue list. If the feature is not possible and it a new capability, we'll guide you to UserVoice as needed. Would also recommend to open one issue for one item, so that we can track things more easily and to ensure that we can get you answers on the things faster.

In these specific things

  1. Not supported - good enhancement suggestion - UserVoice
  2. Question to be asked separately in issue list
  3. Potential bug, so it would be good to get it reported separely, so it's not getting hidden

Also notice that we do recommend using the docs.microsoft.com side of the documentation - much better experience for reading and following up on the tutorials. That document would be here - https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/guidance/using-custom-dialogs-with-spfx.

Since the actual issue which the subject was all about has been tackled, will close this one, but would suggest opening 2 new issues with updated subjects on the topics of #2 and #3 in your message.

VesaJuvonen avatar Dec 05 '17 08:12 VesaJuvonen

@AsishP for your number 2 item, there is an open issue for that here: https://github.com/SharePoint/sp-dev-docs/issues/818 where it is being tracked and has been added to the team's backlog.

thechriskent avatar Dec 05 '17 14:12 thechriskent

Thanks @VesaJuvonen for the guidance. Would follow up on that. A quick feedback, it has been a great interesting journey till now while working with SPFx webparts and extensions. Would be happy to contribute to the community in any way.

AsishP avatar Dec 07 '17 21:12 AsishP

Why can't we use the same way as for a WEBPART ?? https://blog.mastykarz.nl/specify-icon-sharepoint-framework-client-side-web-part/

This would be a good option - with a "officeFabricIconFontName" attribute in JSON.

I'm revisiting this with a new project - and this hasn't been updated in the last 12 months (Nov 2017)...

kachihro avatar Nov 07 '18 06:11 kachihro

Sorry Guys but its really annoying not to have this. In SharePoint you can easily change the theme. When you have an image icon for your extension color which its the same as the theme you get eye cancer. You need to support this in order to have icons that vendors can use for all kind of themes.

barisbikmaz avatar Mar 04 '19 15:03 barisbikmaz

Bump!

StevenDeRoover avatar Mar 27 '19 15:03 StevenDeRoover

Also. I want to define NL in the manifest.json as well. But it does not work "title": { "default": "in EN", "nl-nl": "in NL" }

gulp serve -locale=nl-nl

honb avatar Apr 01 '19 10:04 honb

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 29 '20 12:01 msft-github-bot