HTML in Components

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

For example, the framework automatically converts a standard HTML <div> tag to this component:

<aura:html tag="div" />

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.

Warning

Warning

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

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 Using Expressions.