reactjsiconsreact-tablereact-table-v6

Icons in react-table


I've been struggling to find how I could display an icon in a Cell in a ReactTable (from the library react-table). All I could find is that it accepts HTML symbols. There's a lot of symbols, but what I'm looking for is to show flags...

Cell: () => (
  <span>&hearts;</span>
)

I already tried to use <i class='fa fa-cloud' /> for a test but I couldn't make it work.

Any ideas ?


Solution

  • I found a library https://www.npmjs.com/package/react-flag-kit that gives FlagIcons to be used this way :

    Cell: () => (
        <FlagIcon code="FR" size={20} />
    )
    

    React Icons <Icon /> can also be used in the Cell, but it does not contain any flags.