JSFiddle - React, Tailwind, and code Playground

Demos

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<button onclick="changeLayout('compact')">Use compact form</button>
<button onclick="changeLayout('classic')">Use classic form</button>

<div id="pivot-container"></div>

CSS

html,
body {
    margin: 0 1px;
    padding: 0;
    background: #fff;
    font-family: sans-serif;
    font-size: 12px;
}

button {
    border: 2px solid #df3800;
    background: #fff;
    color: #df3800;
    text-transform: uppercase;
    cursor: pointer;
    margin: 5px 0;
    display: inline-block;
    -webkit-transition: all .3s;
    transition: all .3s;
    font-weight: normal;
    padding: 10px 10px;
    font-size: 14px;
}

button:hover {
    background: #df3800;
    color: #fff;
}

button:focus {
    outline: none;
}

.check {
    display: inline-block;
    text-align: center;
    vertical-align: bottom;
    padding-bottom: 10px;
    padding-left: 5px;
}

JavaScript

const pivot = new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 450,
  report: {
    dataSource: {
      type: "csv",
      filename: "https://cdn.flexmonster.com/data/data.csv",
    },
    options: {
      grid: {
        type: "classic",
      },
    },
    slice: {
      rows: [
        {
          uniqueName: "Country",
        },
        {
          uniqueName: "Business Type",
        },
      ],
      columns: [
        {
          uniqueName: "Color",
        },
        {
          uniqueName: "[Measures]",
        },
      ],
      measures: [
        {
          uniqueName: "Price",
          format: "currency",
        },
      ],
      expandAll: true,
    },
    formats: [
      {
        name: "",
        thousandsSeparator: ",",
        decimalSeparator: ".",
        decimalPlaces: 2,
      },
      {
        name: "currency",
        currencySymbol: "$",
      },
    ],
  },
})

function changeLayout(layoutType) {
  pivot.setOptions({
    grid: {
      type: layoutType,
    },
  })
  pivot.refresh()
}

function customizeCellFunction(cell, data) {
  // your customizations here
}