We have a checkbox which's title should have HTML (<sup></sup>) but its rendered as text rather than HTML.

How to use HTML in a webform component's title?


At first, I misread your question and created Issue #3036393: Allow basic HTML markup in element titles.

Checkboxes do support HTML markup.

The below YAML…

  '#type': checkbox
  '#title': checkbox<sup>sup</sup>
  '#type': checkboxes
  '#title': checkboxes
    one: one<sup>sup</sup>
    two: two<sup>sup</sup>

…renders via Bartik as…

enter image description here

If you can replicate and document this issue, please create a ticket on Drupal.org.

  • i didnt mean the checkbox option, i meant the title of the whole element :) thanks! – Alex Feb 28 '19 at 15:33
  • so doesnt matter if a checkbox, radio, or whatever. your first thought was right, you cant put html in an elements title – Alex Feb 28 '19 at 15:34
  • Whole elements also support HTML in the title. – jrockowitz Feb 28 '19 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.