# speechkit/7.0.0/src/editor/components/toggle/index.js

BeyondWords – AI audio for publishers, version 7.0.0. 50 lines.

- Page: https://pluginprobe.com/plugins/speechkit/7.0.0/code/src/editor/components/toggle/index.js
- Raw: https://pluginprobe.com/plugins/speechkit/7.0.0/raw/src/editor/components/toggle/index.js
- Modified: 2026-08-12T09:46:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/speechkit/7.0.0/code/src/editor/components/toggle/index.js#L10-L20`.

```javascript
/**
 * WordPress dependencies
 */
import { Flex, FlexBlock, FlexItem, FormToggle } from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';

/**
 * BeyondWords toggle control: switch on the left, clickable label to its right.
 *
 * @param {Object}   props
 * @param {string}   [props.className] Extra class for the Flex wrapper.
 * @param {string}   props.label       Visible, clickable label.
 * @param {boolean}  props.checked     Whether the toggle is on.
 * @param {Function} props.onChange    Change handler.
 * @param {boolean}  [props.disabled]  Whether the toggle is disabled.
 *
 * @return {Element} The toggle.
 */
export function Toggle( {
	className,
	label,
	checked,
	onChange,
	disabled = false,
} ) {
	const instanceId = useInstanceId( Toggle, 'beyondwords-toggle' );

	const classes = [ 'beyondwords-toggle', className ]
		.filter( Boolean )
		.join( ' ' );

	return (
		<Flex className={ classes } justify="flex-start" align="center">
			<FlexItem>
				<FormToggle
					id={ instanceId }
					checked={ checked }
					onChange={ onChange }
					disabled={ disabled }
				/>
			</FlexItem>
			<FlexBlock>
				<label htmlFor={ instanceId }>{ label }</label>
			</FlexBlock>
		</Flex>
	);
}

export default Toggle;

```
