get a list of iconNames from office UI fabric

520 Views Asked by At

How can i get a list of valid IconNames from office UI fabric. I am trying to create an icon Picker for an spfx webpart. I've tried importin IconNames from @uiFabric/icons : import{IconNames} from "@uifabric/icons" but i get an error : const enum use is deprcated.

Thanks Russell

1

There are 1 best solutions below

0
On

The Icon.SvgFactory.Example shows how to enumerate the icons defined in the @fluentui-react-icons library.

const icons = Object.keys(ReactIcons).reduce((acc: React.FC[], exportName) => {
  if (!!(ReactIcons as any)[exportName].displayName) {
    acc.push((ReactIcons as any)[exportName] as React.FunctionComponent);
  }

  return acc;
}, []);