The checkbox <input>
is visually hidden with .slds-assistive-text
and a faux checkbox is created using the icon blueprint which allows the display of an icon instead of the standard checkbox.
Click and tap events are captured by a <label>
that encases the entire blueprint. The for
attribute of your <label>
must match the id
attribute of your <input>
.
The states of the checkbox button are styled with the following classes:
Class | State | Description |
.slds-checkbox-button_is-checked | checked | The checked state when the checkbox button has been selected |
.slds-checkbox-button_is-disabled | disabled | The disabled state when the checkbox button has been disabled |
.slds-checkbox-button_is-focused | focused | The focused state when the checkbox button has focus; important for accessibility |
When implementing this blueprint, monitor the state of the checkbox <input>
and apply the appropriate state class listed in the above chart based on the current state of the checkbox <input>
.
It is possible to change the icon used within the checkbox button, see Different Icons for more details.
Different Icon
You may change the utility icon used by the checkbox button depending on the action you are communicating. Reference the utility icon listing for all available options.
This example is using the recycle_bin_empty
utility icon as its base state and the recycle_bin_full
utility icon as its checked state.