JavaScript Data Grid Formatting cells

Change the appearance of cells, using custom CSS classes, inline styles, or custom cell borders.

Overview

Handsontable uses the HTML table structure so customization is based either on referencing to the already existing elements, such as TR/TD, or by applying your own CSS classes to HTML elements.

You can format a cell either using a CSS class or with a style applied directly to the DOM element.

Apply custom CSS class styles

In this example, we add a custom class custom-cell to the cell in the top left corner and add a custom-table CSS class that highlights the table headers.

    Apply inline styles

    You can apply inline styles directly to the DOM element using its style property. You can use the renderer option to do that.

      Custom cell borders

      To enable the custom borders feature, set the customBorders option. This can either be set as true or initialized as an array with a pre-defined setup. For the list of available settings and methods, visit the API reference.

      In the names of the API properties, the words start and end refer to the starting and ending edges of the layout direction.