Newer Version Available

This content describes an older version of this product. View Latest

HTML in Components

An HTML tag is treated as a first-class component by the framework. Each HTML tag is translated into a component, allowing it to enjoy the same rights and privileges as any other component.

You can add HTML markup in components. Note that you must use strict XHTML. For example, use <br/> instead of <br>. You can also use HTML attributes and DOM events, such as onclick.

Some tags, like <applet> and <font>, aren’t supported. For a full list of unsupported tags, see Supported HTML Tags.

Warning

Unescaping HTML

To output pre-formatted HTML, use aura:unescapedHTML. For example, this is useful if you want to display HTML that is generated on the server and add it to the DOM. You must escape any HTML if necessary or your app might be exposed to security vulnerabilities.

You can pass in values from an expression, such as in <aura:unescapedHtml value="{!v.note.body}"/>.

{!expression} is the framework's expression syntax. For more information, see Expressions.