Toggle

TwebBlockToggleControl

{ label, help, name*, onChange, attributes*, setAttributes* }
/**
 * @param {string} [label] - Component label.
 * @param {string} [help] - Component description.
 * @param {string} name - Attribute name.
 * @param {function} [onChange] - Callback called when the value changes.
 * @param {object} attributes - Object containing block attributes.
 * @param {function} setAttributes - Function to set new block attribute values.
 */
block.json
"testToggle": {
	"type": "boolean",
	"default": true
}
index.js
import {
	TwebBlockToggleControl,
} from '@tigriweb/components/attributes';
index.js | edit()
<TwebBlockToggleControl
	label={ [
		__('Toggle Title On', 'your-theme-name'),
		__('Toggle Title Off', 'your-theme-name'),
	] }
	help={ [
		__('Toggle Description On', 'your-theme-name'),
		__('Toggle Description Off', 'your-theme-name'),
	] }
	name="testToggle"
	{ ...{ attributes, setAttributes } }
/>

Last updated

Was this helpful?