Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

458
Views
How to display custom HTML inside AG-Grid column headers?

I'm trying to set the headerName of a column header as HTML in AG-Grid but the HTML is being escaped and a string is being set instead.

I'm aware that you can add a template under headerComponentParams in defaultColDef, however, this would be applied as a default to the whole table rather than just the individual header of a specific column. Following: https://www.ag-grid.com/javascript-data-grid/column-headers/

Is there any option to un-escape the HTML I'm trying to add as the headerName?

Is it possible to do this without creating a custom header component?

If not, what should we do?

const columnDefs = [
    {
          headerName: <span style="color:blue;">Forename</span>, 
          field: "forename", 
          suppressMenu: true
     },
     {
          headerName: <span style="font-size:20px;">Surname</span>, 
          field: "surname", 
          suppressMenu: true
     },
];

const gridOptions = {
    columnDefs: columnDefs,
    rowData: null,
    suppressMenuHide: true,
    defaultColDef: {
        sortable: true,
        resizable: true,
        filter: true,
        width: 150
        }
    }
};
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!