Nov 16 2017 07:02 AM
Hi,
How do I use Office UI Fabric document icons in an SPFX webpart. I'm showing a list of documents and I want to display the appropriate document type icon. The icons are documented at https://developer.microsoft.com/en-us/fabric#/styles/brand-icons, but it gives limited info as to how to use them.
Thanks
Nov 17 2017 01:34 AM
Could you be more specific? If you want a code example, I need to know how you fetch the document and render the HTML? Which library are you using (React, Knockout, none)?
Using the icon is quite easy:
Nov 20 2017 07:58 AM
Hi @Russell Gove, have you tried something like the PnP reusable controls?
There is a list view component there that should have support for icons (I have used it, but without icons). There is also a file type icon component that could be useful (to use directly or to check how it was implemented)
Nov 23 2017 07:08 PM
Thanks, joel. that's just what i was looking for.
Nov 24 2017 02:01 AM
You're welcome. did that work for your scenario?
Nov 25 2017 07:48 AM
hi, i did not get a chance to try that out. i figured out how to do it with just some the fabric css . seems a lot simpler.
Nov 25 2017 07:51 AM
thanks, that's the method i did ended up using and is way less code than other methods i saw used.