gt-extras
  • Get Started
  • API Reference
  1. HTML Helpers
  2. with_tooltip
  • API Reference
  • Plotting
    • gt_plt_bar
    • gt_plt_dot
  • Colors
    • gt_highlight_cols
    • gt_hulk_col_numeric
    • gt_color_box
  • Themes
    • gt_theme_538
    • gt_theme_espn
    • gt_theme_guardian
    • gt_theme_nytimes
    • gt_theme_excel
    • gt_theme_dot_matrix
    • gt_theme_dark
    • gt_theme_pff
  • Icons and Images
    • fa_icon_repeat
    • gt_fa_rating
  • HTML Helpers
    • gt_hyperlink
    • with_tooltip

On this page

  • with_tooltip
    • Parameters
    • Returns
  1. HTML Helpers
  2. with_tooltip

with_tooltip

with_tooltip(label, tooltip, text_decoration_style='dotted', color='blue')

Create HTML text with tooltip functionality for use in GT table cells.

The with_tooltip() function creates an HTML <abbr> element with a tooltip that appears when users hover over the text. The text can be styled with customizable underline styles and colors to indicate it’s interactive.

Parameters

label : str

A string that will be displayed as the visible text.

tooltip : str

A string that will appear as the tooltip when hovering over the label.

text_decoration_style : Literal['solid', 'dotted', 'none'] = 'dotted'

A string indicating the style of underline decoration. Options are "solid", "dotted", or “none”.

color : str | Literal['none'] = 'blue'

A string indicating the text color. If “none”, no color styling is applied.

Returns

: str

An HTML string containing the formatted tooltip element.

gt_hyperlink