Dash - How to create new lines in a markdown tooltip?

Hi there,

I’m trying to format my tooltips so that I can show a different item from a list on a different line, but haven’t managed to yet… I’ve tried using ‘\n’,’
,’ ', all to no avail. Here is my code:

def return_tooltip(column, row, value):
    if column == 'count':
        string_tooltip = ', '.join([x for x in row['fund_name'].split(', ')])
        markdown_tooltip = """**Funds Invested In**:"""
        n_funds = len(string_tooltip.split(', '))
        for i,x in zip(range(1,len(string_tooltip.split(', '))+1),string_tooltip.split(', ')):
            if i < n_funds:
                markdown_tooltip += """
                markdown_tooltip += x
                markdown_tooltip += ""","""
                markdown_tooltip += """
                markdown_tooltip += x
        return markdown_tooltip
        return str(value)
tooltip_data = [
                        column: {'value': return_tooltip(column,row,value), 'type': 'markdown'}
                        for column, value in row.items()
                    } for row in df_temp.to_dict('rows')
1 Like

Bumping this as I have the same issue - did you manage to find a way?