JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div>
  <h2>How to set custom width and height of rows, columns, and headers</h2>
  <p>
  This example demonstrates how to customize the width and height of rows, columns, and headers using CSS.
  </p>
  <p>
  The following CSS selectors are used to style rows, columns, and headers:
  </p>
  <ul>
    <li><code>.fm-grid-row</code> and <code>.fm-grid-row-mobile</code> set the height of rows.</li>
    <li><code>.fm-grid-column</code> and <code>.fm-grid-column-mobile</code> set the width of columns.</li>
    <li><code>.fm-grid-header</code> and <code>.fm-grid-header-mobile</code> set the width and height of headers.</li>
  </ul>
  <p>
  Switch to the CSS box to see an example of using these selectors.
  </p>
</div>

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

CSS

#fm-pivot-view .fm-grid-row,
#fm-pivot-view .fm-grid-row-mobile {
  height: 20px !important;
  min-height: 20px;
}

#fm-pivot-view .fm-grid-column,
#fm-pivot-view .fm-grid-column-mobile {
  width: 50px !important;
  min-width: 50px;
}

#fm-pivot-view .fm-grid-header,
#fm-pivot-view .fm-grid-header-mobile {
  height: 20px !important;
  width: 20px !important;
}

#fm-pivot-view .fm-grid-layout div.fm-cell {
  padding-top: 3px !important;
  padding-bottom: 0 !important;
  font-size: 11px !important;
}

#fm-pivot-view .fm-grid-layout div.fm-sheet-header {
  line-height: 10px !important;
}

/* Description styles */

h2 {
  text-align: center;
}

p {
  font-size: 15px;
  line-height: 1.5;
  padding-right: 10px;
  padding-left: 10px;
}

a {
  color: #00a45a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
    font-size: 105%;
    color: #DF3800;
    background-color: #f5f5f5;
    padding: 1px 4px;
    font-family: monospace !important;
    border-radius: 4px;
}

ul {
  font-size: 15px;
  line-height: 1.5;
}

JavaScript

const pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  height: 400,
  report: {
    dataSource: {
      filename: "data/data.csv"
    },
    slice: {
      rows: [
        {
          uniqueName: "Color"
        },
        {
          uniqueName: "[Measures]"
        }
      ],
      columns: [
        {
          uniqueName: "Country"
        }
      ],
      measures: [
        {
          uniqueName: "Price",
          aggregation: "sum"
        }
      ]
    }
  }
});