I am looking for a Table component in office-ui-fabric-react that I could use in my custom WebPart to display some data coming from an API and that could easily be exported to an Excel sheet if the user wants to do that.
I don't see any table implementation here, which is strange to me because from my understanding Office UI Fabric is kind of like "edit your website like you would edit in Microsoft Office" and Microsoft Office has a table:
https://developer.microsoft.com/en-us/fabric#/controls/web
I have found this example, which uses simple HTML elements to create a table, however after looking around for a while Fabric JS is not the same as Fabric React and we are using the latter:
https://developer.microsoft.com/en-us/fabric-js/components/table/table
After some more digging I actually found this Table in office-ui-fabric-react:
However I'm unable to import it like this:
import { Table } from "office-ui-fabric-react"
After some more digging, I found this example site in the same Github repo:
Which uses the Table, and imports it like this:
import { Table } from '@uifabric/example-app-base/lib/index2';
Then I was able to install this npm package and use Table from it:
https://www.npmjs.com/package/@uifabric/example-app-base
However there is a disclaimer on it: "These components are primarily intended for use within the office-ui-fabric-react repo. Therefore, the APIs may be unstable."
So I'm not sure if this is the best way to go about this and I also don't see any Excel export functionality.
Looks like there is a table after all.
It's called DetailsList (lol):
https://developer.microsoft.com/en-us/fabric#/controls/web/detailslist
Excel export has to be done manually: