Input Checkbox (Deprecated)

ui:inputCheckbox

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

We recommend using Lightning Web Components whenever possible. When migrating to Lightning Web Components, use lightning-input with checkbox, toggle, or checkbox-button type. For checkbox groups, use lightning-checkbox-group.

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

A ui:inputCheckbox component represents a checkbox whose state is controlled by the value and disabled attributes. It's rendered as an HTML input tag of type checkbox. To render the output from a ui:inputCheckbox component, use the ui:outputCheckbox component.

This is a basic set up of a checkbox.

This example results in the following HTML.

The value attribute controls the state of a checkbox, and events such as click and change determine its behavior. This example updates the checkbox CSS class on a click event.

To create forms for Salesforce objects without using Apex controllers, use lightning:inputField with lightning:recordEditForm, or use lightning:recordForm. To create an input field for different data types, use lightning:input.