Newer Version Available

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

ui:inputRichText

An input field for entering rich text.

By default, ui:inputRichText renders a WYSIWYG editor for entering rich text. Setting isRichText="false" uses the ui:inputTextArea component instead of a WYSIWYG editor.

The width and height of the rich text editor are independent of those on the ui:inputTextArea component. To set the width and height of the component when you set isRichText="false", use the cols and rows attributes. Otherwise, use the width and height attributes.

ui:outputRichText supports a list of HTML tags that are supported by CKEditor. Tags such as <script> are removed.

This example shows a text area and WYSIWYG editor.

1<aura:component>
2 <ui:inputRichText aura:id="inputRT" label="Rich Text Demo" labelPosition="hidden" cols="50" rows="5" value="&lt;b&gt;Aura&lt;/b&gt;, &lt;span style='color:red'&gt;input rich text demo&lt;/span&gt;"/>
3 <ui:button aura:id="outputButton" buttonTitle="Click to see what you put into the rich text field" label="Display" press="{!c.getInput}"/>
4    <ui:outputRichText aura:id="outputRT" value=" "/> 
5</aura:component>
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17({
18	getInput : function(cmp) {
19
20		var userInput = cmp.find("inputRT").get("v.value");
21		var output = cmp.find("outputRT");
22		output.set("v.value", userInput);
23	}
24})

Attributes

Attribute Name Attribute Type Description Required?
body Component[] The body of the component. In markup, this is everything in the body of the tag.
class String A CSS style to be attached to the component. This style is added in addition to base styles output by the component.
cols Integer The width of the text area, which is defined by the number of characters to display in a single row at a time. Default value is “20”.
disabled Boolean Specifies whether the component should be displayed in a disabled state. Default value is "false".
height String The height of the editing area (that includes the editor content). This can be an integer, for pixel sizes, or any CSS-defined length unit.
label String The text of the label component
labelClass String The CSS class of the label component
maxlength Integer The maximum number of characters that can be typed into the input field. Corresponds to the maxlength attribute of the rendered HTML textarea element.
placeholder String The text that is displayed by default.
readonly Boolean Specifies whether the text area should be rendered as read-only. Default value is “false”.
required Boolean Specifies whether the input is required. Default value is "false".
requiredIndicatorClass String The CSS class of the required indicator component
resizable Boolean Specifies whether or not the textarea should be resizable. Defaults to true.
rows Integer The height of the text area, which is defined by the number of rows to display at a time. Default value is “2”.
updateOn String Updates the component's value binding if the updateOn attribute is set to the handled event. Default value is "change".
value String The value currently in the input field.
width String The editor UI outer width. This can be an integer, for pixel sizes, or any CSS-defined unit. If isRichText is set to false, use the cols attribute instead.

Events

Event Name Event Type Description
mouseup COMPONENT Indicates that the user has released the mouse button.
mousedown COMPONENT Indicates that the user has pressed a mouse key.
mousemove COMPONENT Indicates that the user has moved the mouse pointer.
dblclick COMPONENT Indicates that a component has been double-clicked.
mouseout COMPONENT Indicates that the user has moved the mouse pointer away from the component.
click COMPONENT Indicates that a component has been clicked.
mouseover COMPONENT Indicates that the user has moved the mouse pointer over the component.
keyup COMPONENT Indicates that the user has released a keyboard key.
keypress COMPONENT Indicates that the user has pressed and held down a keyboard key.
select COMPONENT Indicates that the user has made a selection.
keydown COMPONENT Indicates that the user has pressed and released a keyboard key.
focus COMPONENT Indicates that a component has been put on focus.
blur COMPONENT Indicates that a component has been put out of focus.
validationError COMPONENT Indicates that the component has validation error(s).
paste COMPONENT Indicates that the user has pasted content from the clipboard.
change COMPONENT Indicates that the content of a component or the state has changed.
clearErrors COMPONENT Indicates that any validation error should be cleared.
cut COMPONENT Indicates that the user has cut content to the clipboard.
copy COMPONENT Indicates that the user has copied content to the clipboard.