Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a guide for adding a setting to an existing tools panel like typography #133

Open
fabiankaegy opened this issue May 17, 2023 · 0 comments
Labels
Good First Issue Good for newcomers Guide

Comments

@fabiankaegy
Copy link
Member

Essentially a guide for <InspectorControls group="typography"> with the usage of the experimental ToolsPanelItem

<InspectorControls group="typography">
	<ToolsPanelItem
		hasValue={() => !!value}
		label={__('Labelt', 'namespace')}
		onDeselect={() => setAttributes({ value: undefined })}
		resetAllFilter={() => ({
			value: undefined,
		})}
		onSelect={() => setAttributes({ value: 'left' })}
		panelId={clientId}
	>
		<ToggleGroupControl
			label={__('Label', 'namespace')}
			value={value}
			onChange={(value) => setAttributes({ value: value })}
		>
			<ToggleGroupControlOption value="left" label={__('Left', 'namespace')} />
			<ToggleGroupControlOption value="right" label={__('Right', 'namespace')} />
		</ToggleGroupControl>
	</ToolsPanelItem>
</InspectorControls>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers Guide
Projects
None yet
Development

No branches or pull requests

1 participant