File size: 475 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { ToggleControl } from '@wordpress/components';
import { useState } from 'react';

const ToggleControlExample = () => {
	const [ hasFixedBackground, setHasFixedBackground ] = useState( true );
	return (
		<ToggleControl
			label="Does this have a fixed background?"
			help={ hasFixedBackground ? 'Has fixed background' : 'No fixed background' }
			checked={ hasFixedBackground }
			onChange={ setHasFixedBackground }
		/>
	);
};

export default ToggleControlExample;