Icons in react-table

Orlyyn picture Orlyyn · Mar 14, 2018 · Viewed 7k times · Source

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 ?

Answer

Orlyyn picture Orlyyn · Mar 15, 2018

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.