8000 Web Components docs · Issue #1 · w3c-cg/webdocs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Web Components docs #1

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

Open
trusktr opened this issue Apr 16, 2025 · 9 comments
Open

Web Components docs #1

trusktr opened this issue Apr 16, 2025 · 9 comments

Comments

@trusktr
Copy link
trusktr commented Apr 16, 2025

We have a docs-and-guides channel in the WCCG discord: https://discord.gg/PZH8ucFHp2

It'll be nice to coordinate on web docs. The WCCG started a docs site at https://webcomponents.guide.

@Elchi3
Copy link
Collaborator
Elchi3 commented Apr 23, 2025

Hey @trusktr! Thanks for filing this issue! The Docs CG just started its work yesterday! We are wondering if we should talk about Web Components in our next Community Group call. Would you be up for that? We're meeting every 2nd Tuesday, at 5pm CEST. I'm going to sent out an invite for May 6 soon.

We had a few questions:

Looking forward to chat about Web Component docs either here or in the call!

@Elchi3
Copy link
Collaborator
Elchi3 commented Apr 25, 2025

In preparation for the W3C Docs CG call on Web Components, I took a look at the survey responses from the 2024 State of HTML survey:

Some survey free form responses specifically on the quality of WC docs:

  • Hard to find documentation on making actual web components rather than react
  • Lack of good manuals, tutorials, best practices and patterns
  • Lack of practical resources, either chunks of references or badly written articles
  • no documentation on lifecycle hooks apart from the spec
  • Native web components technologies have bad documentation
  • Not a lot of examples and documentation around
  • Lack of a good introductory tutorial on web components. The existing tutorials all seem to be geared towards people coming from other JS frameworks, but not for someone starting with html

From other free form responses you can derive unanswered questions that web developers have. Possibly a starting point to check in current docs if are helpful to give answers or guidance at all.

  • How to make shadow dom elements styleable?
  • How to let in styles into the shadow dom? / How to share styles?
  • How are you meant to use declarative shadow DOM without repeating the markup? / How to avoid so much boilerplate code?
  • When to use Shadow Dom and when not?
  • Accessibility of items in the shadow DOM?
  • The shadow DOM is extremely tough to set up / too much complexity
  • How to communicate data between document and shadow DOM?
  • How to install WC's/make them available?

@Elchi3
Copy link
Collaborator
Elchi3 commented Apr 25, 2025

@tayloregivens gave a talk on Web Components: https://www.youtube.com/watch?v=dEFfqqJWLwQ. It provided me a great overview into current WC discussions.

Some quotes I found interesting and that maybe hint at how people (don't) adopt WC's currently.

  • "There is no marketing team for WC. Enterprises are using them and it's quietly taking over because it is a useful feature but you kinda need specialists and well-resourced teams to pick it apart and figure out how to use it because it's more of a low-level tool. For the average developer, they use it using libraries such as lit or or fast or they might be using it in React if it is implemented under the hood. But most commonly we see it being used on the enterprise scale by more well-resourced teams."

  • "Vanilla web components are pretty difficult to use by themselves"

  • "We win and move things forward by shipping and working more closely with WC libraries"

  • @atopal asked: "How we can see more adoption of WCs?" and Taylore said: "I had to do a lot of research for this talk to really understand where WC's are at." [...] "Find someone in enterprise teams to talk about WCs, but for hobbyist who are using it on a smaller scale, its harder for them to have access to resources and knowledge."

So, this hints that more docs are needed to get the hang of WCs and also that frameworks play a major role here.

@Elchi3
Copy link
Collaborator
Elchi3 commented May 5, 2025

Brief look into the current content outlines we seem to have. It's not a lot, so the needs expressed above are probably not addressed by the current state of the docs on neither MDN or webcomponents.guide:

MDN

(kept relatively up-to-date)

webcomponents.guide

(last updated in 2023?)

@justinfagnani
Copy link

@Elchi3 a few years ago we tried to start a docs-and-guides effort in the WCCG. We came up with this content outline to work from: https://github.com/webcomponents-cg/docs-and-guides/blob/main/plan/outline.md

@Elchi3 Elchi3 changed the title Web Components CG -> docs for Custom Elements. Web Components docs May 7, 2025
@Elchi3
Copy link
Collaborator
Elchi3 commented May 7, 2025

Yesterday's Docs CG call was all about Web Components. Here are the meeting notes: Notes from yesterday's call: https://github.com/w3c-cg/webdocs/blob/main/meetings/2025-05-06.md

@wbamberg
Copy link
wbamberg commented May 7, 2025

Looking at the WC docs on MDN, and thinking of the context of today's call, I would say that the MDN docs are very much targeted at "implementing your own WC from scratch" and don't really acknowledge the existence of libraries, or what someone might need to know who is using a library.

So for instance the main guide is https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements, which is mostly about implementing a custom element.

I think it would be worth looking at these docs from the perspective of two audiences: people writing custom elements from scratch, and people using a library like Lit. And making this distinction explicit in the docs: essentially providing two separate paths for people.

We could also review the Lit docs to understand where the points are that they want to reach out into library-agnostic docs.

Another separate issue is that there's no guide material on MDN about ElementInternals.

@tidoust
Copy link
tidoust commented May 7, 2025

Another angle highlighted in yesterday's call was that guides are missing for "using a web component" in the sense of "integrating a web component coming from a third party within a page": how to define slots when you instantiate the component, how to use :defined or :slotted, and how to style the component in general, how to register for events that the element may fire, etc.

That part of the guide would be independent from the library that might have been used to create the web component.

@justinfagnani
Copy link

I think it would be worth looking at these docs from the perspective of two audiences: people writing custom elements from scratch, and people using a library like Lit. And making this distinction explicit in the docs: essentially providing two separate paths for people.

From the Lit team's point of view on this, I think it's worthwhile examining the docs from these two perspectives, but I'm less sure about two actually different paths. At least in Lit's case there isn't anything in the vanilla web components reference or concepts that we wouldn't want developers to know. For example, while Lit does implement some of the standard lifecycle callbacks for the developer, the developer should ideally still understand them and can still override and implement them themselves.

One type of thing that could have some separate vanilla vs library guidance is best practices that libraries take care of for you, like using templates, batching DOM updates, implementing reactive class properties, and reflecting attributes. These are things have a little bit of opinion to them, and need glue code and patterns just above the most basic usage of the raw APIs.

I do think that two paths should exist for writing vs using custom elements, especially so that component authors have common high quality docs to point their users to for fundamental platform behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
0