-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Learning about best practices to use @wordpress/components #64097
Comments
Here are some thoughts:
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 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
I wouldn't rely on that article, as it's likely outdated.
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 |
@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:
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 ( TLDR; Beginners need to experience that aha moment and feel the win of "creating their first block" |
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:
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 #62880 (comment) to its own separate issue.
cc @WordPress/gutenberg-components
The text was updated successfully, but these errors were encountered: