Core Features

Advanced Features

Vue Data GridTooltips

Version 36.2.0

Tooltips can be set for cells and column headers.

The following Column Definition properties configure tooltips:

tooltipCopy Link
TooltipDefinition
Tooltip for the cell.
  • true shows the displayed cell value (valueFormatted when present, otherwise value).
  • false disables tooltip content configured on the Column Definition.
  • A string shows static content.
  • A callback resolves the content from the supplied params.
  • When the column is grouped, group rows in the generated group column inherit this value.

    Use tooltip: true for the common case where the tooltip should match the displayed cell value. This uses valueFormatted when present, otherwise value, regardless of whether the value came from field or valueGetter.

    <ag-grid-vue
        :columnDefs="columnDefs"
        /* other grid options ... */>
    </ag-grid-vue>
    
    this.columnDefs = [
        { field: 'price', valueFormatter: priceFormatter, tooltip: true },
        { field: 'status', tooltip: 'Current status' },
        { field: 'athlete', tooltip: (params) => `Country: ${params.data?.country}` },
        { field: 'internalId', tooltip: false },
    ];

    tooltip: false disables cell tooltip content supplied by tooltip, tooltipField, or tooltipValueGetter. Tooltips supplied at runtime by a Cell Renderer using setTooltip, and grid-owned validation or formula error tooltips, remain available. These independent tooltip sources continue to use the column's tooltipComponent and tooltipComponentParams when configured.

    The same value forms are accepted by headerTooltip. With headerTooltip: true, the displayed header name is used. Setting headerTooltip: false does not disable a tooltip supplied at runtime by a custom Header Component using setTooltip.

    Tooltip Callback Copy Link

    Cell and header tooltip callbacks receive the same parameters. value is the underlying cell value or displayed header name, and valueFormatted contains the formatted value when available.

    Properties available on the TooltipCallbackParams<TData = any, TValue = any, TContext = any> interface.

    locationCopy Link
    TooltipLocation
    What part of the application is showing the tooltip, e.g. 'cell', 'header', or 'menu'.
    The source value. For cell tooltips, this is the cell value before tooltip content is resolved.
    valueFormattedCopy Link
    string | null
    The formatted source value, when available.
    colDefCopy Link
    ColDef | ColGroupDef | null
    Column / ColumnGroup definition.
    columnCopy Link
    Column | ColumnGroup | ProvidedColumnGroup
    Column / ColumnGroup
    rowIndexCopy Link
    number
    The index of the row containing the cell rendering the tooltip.
    The row node.
    Data for the row node in question.
    The grid api.
    Application context as set on gridOptions.context.

    Tooltips for Truncated Text Copy Link

    It's possible to configure tooltips to show only when the items hovered are truncated by setting tooltipShowMode = 'whenTruncated'.

    tooltipShowMode = 'whenTruncated' has no effect when using Browser Tooltips, as Browser Tooltips are controlled by the browser and not the grid.

    Show and Hide Delay Copy Link

    By default, tooltips show after 2 seconds and hide after 10 seconds. These delays can be configured in milliseconds:

    tooltipShowDelayCopy Link
    number
    default: 2000
    The delay in milliseconds that it takes for tooltips to show up once an element is hovered over. Note: This property does not work if enableBrowserTooltips is true.
    tooltipSwitchShowDelayCopy Link
    number
    default: 200
    The delay in milliseconds before a tooltip is shown when moving the pointer from one tooltip-enabled element to another while the previous tooltip is still visible or pending hide. Note: This property does not work if enableBrowserTooltips is true.
    tooltipHideDelayCopy Link
    number
    default: 10000
    The delay in milliseconds that it takes for tooltips to hide once they have been displayed. Note: This property does not work if enableBrowserTooltips is true and tooltipHideTriggers includes timeout.
    <ag-grid-vue
        :tooltipShowDelay="tooltipShowDelay"
        :tooltipSwitchShowDelay="tooltipSwitchShowDelay"
        :tooltipHideDelay="tooltipHideDelay"
        /* other grid options ... */>
    </ag-grid-vue>
    
    this.tooltipShowDelay = 0;
    this.tooltipSwitchShowDelay = 1000;
    this.tooltipHideDelay = 2000;

    Setting delays will have no effect if using Browser Tooltips as Browser Tooltips are controlled by the browser and not the grid.

    Blank Values Copy Link

    Tooltips are not shown for the missing values undefined, null and "" (empty string). To display a tooltip for a missing value, use a callback that returns non-empty content.

    In the example below:

    • The data has missing values undefined, null and '' (empty String) as the first three rows.
    • Column A uses tooltip: true, so no tooltip is shown for a missing displayed value.
    • Column B uses a tooltip callback to return fallback content, so a tooltip is shown.

    Row Groups Copy Link

    When a column is grouped, the generated group column inherits tooltip, tooltipComponent, and tooltipComponentParams from the underlying column's Column Definition. This is consistent with how valueFormatter is inherited. With groupDisplayType: 'multipleColumns', the group column header also inherits headerTooltip.

    Cell tooltip properties set on autoGroupColumnDef (tooltip and tooltipComponent) apply to leaf rows only. headerTooltip still applies to the group column header.

    In the example below:

    • The Country and Year columns each define a tooltip callback. Hover a group key to see the tooltip inherited from the underlying column.
    • autoGroupColumnDef defines a tooltip callback. Hover a leaf row in the group column to see it.

    autoGroupColumnDef cell tooltip properties apply to leaf rows only. Group rows inherit their cell tooltips from the underlying column colDef.

    Grouped Column Headers Copy Link

    With groupDisplayType: 'multipleColumns', each generated group column header inherits the headerTooltip from its underlying column colDef. Hover a group column header in the example below to see the inherited tooltip.

    Full Width Group Rows Copy Link

    With groupDisplayType: 'groupRows', full-width group rows inherit their tooltips from the underlying column colDef. Hover a group row in the example below to see the tooltip defined on the grouped column.

    Aggregated Cells Copy Link

    When a group row displays an aggregated value in a data column, hovering that cell shows a tooltip for the aggregated value, not the underlying row data.

    Touch Devices Copy Link

    On iOS and Android, press and hold a tooltip-enabled grid element to show its rich HTML tooltip. The tooltip opens as soon as the long press is recognised, without applying tooltipShowDelay a second time. Moving the touch before the long press completes cancels the gesture. Tap elsewhere to dismiss the tooltip. Grid gestures that already use the long press, such as the context menu and column menu, take precedence over the tooltip. Setting suppressTouch=true disables this gesture. Browser Tooltips remain controlled by the browser.

    Mouse Tracking Copy Link

    The example below enables mouse tracking to demonstrate a scenario where tooltips need to follow the cursor. To enable this feature, set the tooltipMouseTrack to true in the gridOptions.

    Browser Tooltip Copy Link

    Set the grid property enableBrowserTooltips=true to stop using rich HTML Components and use the browsers native tooltip.

    Interactive Tooltips Copy Link

    By default, tooltips cannot be interacted with and hovering them has no effect. If tooltipInteraction=true is set in the grid options, tooltips remain visible while being hovered and their content can be selected or activated.

    <ag-grid-vue
        :tooltipInteraction="tooltipInteraction"
        /* other grid options ... */>
    </ag-grid-vue>
    
    this.tooltipInteraction = true;

    The example below enables Tooltip Interaction to demonstrate a scenario where tooltips will not disappear while hovered. Note following:

    • Tooltips will not disappear while being hovered.
    • Tooltips content can be selected and copied.
    • Tab moves focus into focusable tooltip content and Escape closes the tooltip.

    The example below shows Tooltip Interaction with Custom Tooltips. Note the following:

    • Tooltip is enabled for the Athlete and Age columns.
    • Tooltips will not disappear while being hovered.
    • The custom tooltip displays a text input and a Submit button which when clicked, updates the value of the Athlete Column cell in the hovered row and then closes itself by calling hideTooltipCallback().

    Custom Component Copy Link

    The grid does not use the browser's default tooltip, instead it has a rich HTML Tooltip Component. The default Tooltip Component can be replaced with a Custom Tooltip Component using colDef.tooltipComponent.

    In the example below:

    • tooltipComponent is set on the Default Column Definition so it applies to all Columns.
    • tooltipComponentParams is set on the Athlete Column Definition to provide a Custom Property, in this instance setting the background color.

    When a custom tooltip component is instantiated then the following will be made available on this.params:

    Properties available on the ITooltipParams<TData = any, TValue = any, TContext = any> interface.

    The resolved value to render in the tooltip.
    hideTooltipCallbackCopy Link
    Function
    A callback function that hides the tooltip.
    locationCopy Link
    TooltipLocation
    What part of the application is showing the tooltip, e.g. 'cell', 'header', or 'menu'.
    valueFormattedCopy Link
    string | null
    The formatted source value, when available.
    colDefCopy Link
    ColDef | ColGroupDef | null
    Column / ColumnGroup definition.
    columnCopy Link
    Column | ColumnGroup | ProvidedColumnGroup
    Column / ColumnGroup
    rowIndexCopy Link
    number
    The index of the row containing the cell rendering the tooltip.
    The row node.
    Data for the row node in question.
    The grid api.
    Application context as set on gridOptions.context.