How to apply custom styles to the pivot table headers?
Introduction
In certain scenarios, you may want to personalize the appearance of your header cells to enhance readability and improve the presentation of data. This article explains how to apply custom styles to the row and column headers of React Pivot Table.
Customizing row and column headers
To customize the header styles of a pivot table, you can target the built-in CSS classes associated with the pivot table’s header cells. Here’s an example of how you can change the background color and font family of both column and row headers.
[index.css]
/* Customize the column headers here. */
.e-pivotview .e-headercell {
background-color: thistle !important;
font-family: cursive;
}
/* Customize the row headers here. */
.e-pivotview .e-rowsheader {
background-color: skyblue !important;
font-family: 'Franklin Gothic Medium';
}
In the above code snippet, we are targeting the CSS classes .e-headercell
and .e-rowsheader
within the .e-pivotview
container. These classes represent the column headers and row headers, respectively. Inside the curly braces, you can define the styles that you want to apply. In this example, we have set the background-color
property to thistle for the column headers and skyblue for the row headers. Additionally, we have modified the font-family
of the column header to cursive and the row header to Franklin Gothic Medium. By applying these styles, you can easily personalize the appearance of the pivot table headers.
The following screenshot portrays the results of the code snippet mentioned above.
Screenshot
For a practical demonstration, refer to the sample of stackblitz.
Conclusion:
I hope you enjoyed learning how to apply custom styles to the pivot table headers.
You can refer to our React Pivot Table feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our React Pivot Table example to understand how to create and manipulate data.
For current customers, you can check out our components on the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!