Open ciampo opened 4 months ago
Here are some thoughts:
what to do with these marked as experimental
As of today, "experimental" components that are exported from the package can be assumed as mostly stable, as explained in the docs. We are in the process of slowly removing the "experimental" designation, but it will take a while.
Components exposed as the private APIs, however, should be assumed as private, WIP, and generally not safe to use. We usually leverage private APIs to start testing new apis and components in the editor before making them available via the public APIs. We intend for such private APIs not to stay private indefinitely.
the guide on how to assemble existing components [...] In general, how to think about the system holistically
The best place to start on how to combine existing components together is the components' docs, both in the form of JSDocs and Storybook examples.
We don't currently have generic documentation on this topic, but if there's appetite for it, we should consider it.
The fact that the @wordpress/components
package exposes different paradigms doesn't help.
that article from WP Tavern seems relevant: wptavern.com/g2-components-a-from-scratch-reimagining-of-wordpress-components.
I wouldn't rely on that article, as it's likely outdated.
I needed something like that to accelerate the process of transforming Figma designs into React components.
Do you have concrete examples of what components you'd need to work on, or is only an hypothesis ?
@juanmaguitar, @justintadlock, @ndiego, @ryanwelcher, what was your journey when you started learning how to use @wordpress/components
efficiently? How would you educate beginners so they get up to speed quickly on how to build block's UI with them? In particular, the sidebar has a lot of space for expression and applies even more when using Slot/Fill through UI plugins.
@gziolo Adding my experience here as I found the learning curve to be very steep and resources/tutorials were all over the place. This took place over the last 2-3 years:
Storybook was probably the most helpful because I could see all the available components and play with them. From there I'd usually see how a core block was implementing a control.
Just recently I referenced the core heading block to see how it setup the heading level control in the toolbar. That's an example where I couldn't find docs or find anything in Storybook.
To your question: How would you educate beginners so they get up to speed quickly on how to build block's UI with them?
I think simple templates for npx @wordpress/create-block. This package was so helpful in getting started and I think it could be taken a step further by having templates for the basic controls:
npx @wordpress/create-block my-dynamic-block variant=block-with-text-control
npx @wordpress/create-block my-dynamic-block variant=block-with-select-control
npx @wordpress/create-block my-dynamic-block variant=block-with-toggle-control
npx @wordpress/create-block my-dynamic-block variant=block-with-advanced-controls
(text, select, and toggle control etc.)This could be a learning style preference but I find it easier to have a working example from the start and then move backwards to figure out how it works.
One last thing I'd add is considering adding a command for WordPress Playground. In our custom blocks we now have a command in package.json (start:playground
) that will start the block build process and spin up WordPress Playground.
TLDR; Beginners need to experience that aha moment and feel the win of "creating their first block"
How would you educate beginners so they get up to speed quickly on how to build block's UI with them?
I think the Block Development Examples is a great resource for getting up to speed on building blocks' UIs with components. More examples could be added, of course, but here are some excellent examples of blocks using components:
plugin-sidebar
slot.These examples are a good reference to start working with components as you can install them in your own WP installation and start playing with them (you can also see the code and a demo online among some other things)
Moving this conversation originally started by @gziolo in https://github.com/WordPress/gutenberg/issues/62880#issuecomment-2250015570 to its own separate issue.
cc @WordPress/gutenberg-components