humanmade / humanmade/block-editor-components

Inspector component hooks

Open
#307 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
76
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I had an idea of using hooks to provide super quick to create block inspector controls. You'd call the hook with an attribute and attribute name, and it would return the value and an inspector component ready to slot into a block inspector slot

Something like this:

```js
const { title, titleControl } = useTextField( 'title', attributes.title );
const { headerImageSrc, headerImageId, headerImageControl } = useImageField( 'headerImageId' attributes.headerImageId );

{ titleControl }
{ headerImageControl }

```

I can see this being a super easy way to spin up a blocks attributes and their UI for checkboxes, images, etc

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.