ToggleControl is used to generate a toggle user interface.
Render a user interface to change fixed background setting.
<ToggleControl
label={ __( 'Fixed Background' ) }
checked={ !! hasParallax }
help={ ( checked ) => checked ? __( 'Has fixed background.' ) : __( 'No fixed background.' ) }
onChange={ toggleParallax }
/>
The component accepts the following props:
If this property is added, a label will be generated using label property as the content.
- Type:
String
- Required: No
If this property is added, a help text will be generated using help property as the content.
- Type:
String
|Function
- Required: No
If checked is true the toggle will be checked. If checked is false the toggle will be unchecked. If no value is passed the toggle will be unchecked.
- Type:
Boolean
- Required: No
A function that receives the checked state (boolean) as input.
- Type:
function
- Required: Yes