office-ui-fabric

How to render a column header with both text and a tooltip icon in Fabric DetailsList


In a DetailsList, is it possible to render a specific column header with both text and an icon with a tooltip like this: (I tried with onRenderDetailsHeader but I'm not sure how to handle a specific column).

enter image description here


Solution

  • Here is a Codepen I put together real quick. The only issue is that I couldn't get the info icon rendered as a target for the tooltip. Maybe this will give you a good start.

    function onRenderDetailsHeader(props, defaultRender?) {
       return defaultRender!({
          ...props,
          onRenderColumnHeaderTooltip: (tooltipHostProps) => {
             return (
                <Fabric.TooltipHost {...tooltipHostProps} />
             )
          }
       })
    }