File size: 571 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { FormLabel } from '@automattic/components';
import { FormToggle } from '@wordpress/components';
import { useState } from 'react';

const FormToggleExample = () => {
	const [ isChecked, setChecked ] = useState( true );

	return (
		<FormLabel>
			<FormToggle
				checked={ isChecked }
				onChange={ () => {
					setChecked( ! isChecked );
				} }
			/>
			<span>
				This example mixes Calypso components with WordPress components by using Calypso's FormLabel
				to wrap Gutenberg's FormToggle
			</span>
		</FormLabel>
	);
};

export default FormToggleExample;