LyteNyte Grid logo for light mode. Links back to the documentation home page.
Columns

Column Header Renderer

Every column may define a unique header renderer to determine the content that should be displayed in the header cell.

A header renderer is a custom React component that LyteNyte Grid uses to render header cell content. Use the headerRenderer property on the column specification to set the component.

Header Renderers

Creating a header renderer involves the following steps:

  1. Define a custom React component function that accepts an object of type Grid.T.HeaderParams as its props.
  2. Set the value of the headerRenderer property for each column that should use this renderer.

The demo below shows this in action. Each column has a custom headerRenderer that adds an icon based on the column ID.

Header Renderers

Fork code on stack blitzFork code on code sandbox

The header renderer in the demo is a normal React component. LyteNyte Grid renders it within the same React tree as the rest of your application. This means the renderer can access React context and use any React hooks.

Next Steps

  • Column Resizing: Change column widths programmatically or via user interaction.
  • Column ID & Name: Define user-friendly column names and ensure unique IDs.
  • Column Moving: Reorder columns programmatically or through drag-and-drop.
  • Column Field: Control how a column retrieves its value for each cell.