Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ag-Grid customize tooltip using CSS

Tags:

I was wondering whether there is a way to customize the built-in tooltip and the header tooltip using CSS? Is there a class name that can be referenced?

like image 436
al529 Avatar asked Feb 08 '19 19:02

al529


2 Answers

Yes, there is a class called ag-tooltip in ag-grid.css

I'm able to customized the default headerTooltip, something like below:

.ag-tooltip{
   background-color: #0f1014;
   color: #999eab;
   border-radius: 2px;
   padding: 5px;
   border-width: 1px;
   border-style: solid;
   border-color: #545454;
}
like image 131
Waseem Barcha Avatar answered Sep 20 '22 12:09

Waseem Barcha


In case you want to customize tooltip using a 3rd party library, you can make use of cell renderer component.
Here is an example using angular cell renderer component and ngx-bootstrap.

@Component({
    selector: 'tooltip-cell',
    template: `<span tooltip="Custom text" container="body">{{params.value}}</span>`,
})
export class ToolTipRenderer implements ICellRendererAngularComp {
    public params: any;

    agInit(params: any): void {
        this.params = params;
    }

    refresh(): boolean {
        return false;
    }
}

Once created, you can register the custom cell renderer component using frameworkComponents gridOption. You can more details in the official doc here and more details on Cell Renderer Components

like image 30
Pratik Bhat Avatar answered Sep 18 '22 12:09

Pratik Bhat