Skip to content

Using UI Fabric Icons for ListView Commands #642

@thechriskent

Description

@thechriskent

Category

  • 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
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:spfxCategory: SharePoint Framework (not extensions related)type:uservoice-requestEnhancements & feature requests should be posted: http://aka.ms/sp-dev-uservoice

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions