Superscripts in labels in dash-core-components RadioItems

To put superscripts in the labels of RadioItems, I found I could use a Unicode string like this:

            options = [{'label': u'10\u00b9\u00b9', 'value': 1.e11},
                           {'label': u'10\u00b9\u00b2', 'value': 1.e12},
                           {'label': u'10\u00b9\u00b3', 'value': 1.e13}],

Is this the only option for formatting of the labels?

1 Like

Hm, that’s a good question. For the moment, I believe that this is the only solution. In the future, we may have an “html renderer” option for dropdowns which would all you to specify something like [10, html.Sup(9)] or maybe even 10<sup>9</sup>. This <sup> (“superscript”) syntax is what we use in plotly.js (https://help.plot.ly/adding-HTML-and-links-to-charts/)

1 Like

@chriddyp I think this should be added (some way to properly format strings, either use HTML entities or maybe allow markdown or something [best option would be to allow any HTML element inside obviously] )
Inserting unicode characters makes it show up very small and unreadable.