Output Checkbox (Deprecated)

ui:outputCheckbox

Deprecated as of API version 47.0. We recommend migrating to Lightning Web Components and using the lightning-input component.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App

Deprecation Guidelines 

We recommend using Lightning Web Components whenever possible. When migrating to Lightning Web Components, use lightning-input with checkbox type and set readonly to true.

For more information, see Aura Components in the ui Namespace Are Deprecated.

Usage Overview (Deprecated) 

A ui:outputCheckbox component represents a checkbox that is rendered as an HTML img tag. This component can be used with ui:inputCheckbox, which enables users to select or deselect the checkbox. To select or deselect the checkbox, set the value attribute to true or false. To display a checkbox, you can use an attribute value and bind it to the ui:outputCheckbox component.

1<aura:attribute name="myBool" type="Boolean" default="true" />
2
3<ui:outputCheckbox value="{!v.myBool}" />

The previous example renders the following HTML.

1<img class="checked uiImage uiOutputCheckbox" alt="checkbox checked" src="path/to/checkbox" />

To display record data for Salesforce objects, use lightning:outputField with lightning:recordViewForm, or use lightning:recordForm. To display record data with a custom layout, use force:recordData.

Note

Attributes 

NameDescriptionTypeDefaultRequired
altCheckedThe alternate text description when the checkbox is checked. Default value is “True”.StringTrue
altUncheckedThe alternate text description when the checkbox is unchecked. Default value is “False”.StringFalse
bodyThe body of the component. In markup, this is everything in the body of the tag.Aura.Component[]
classA CSS style to be attached to the component. This style is added in addition to base styles output by the component.String
labelThe label text for checkbox. Default value is “Active”.StringActive
valueSpecifies whether the checkbox is checked.Boolean