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

allowed elements for slots #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jogibear9988
Copy link
Contributor

No description provided.

@thepassle
Copy link
Collaborator

How would a developer provide this information?

@Westbrook
Copy link

Westbrook commented Jun 26, 2021

Is there a way to fully require this at runtime? The listing would be more of a suggestion, right? In this way maybe expectedChildren might be more correct? Accepting selector strings, or base classes would be very interesting.

Maybe there's room for riffing on the attribute syntax:

* @attr {Boolean} disabled - This jsdoc tag documents an attribute.

Here you apply a type to the attribute, it would be interesting to be able to add a element type and/or tag name in a form like:

* @slot {Button | my-button} submit - the custom button used for the "submit" action interface.

Fits in with the feeling behind this tweet: https://twitter.com/UXtechnologist/status/1408438674702929922

Question to my colleagues who work on #designsystems: How are you dealing with the fact that web components can accept any other components as children?
Our design tools don't seem to encourage defining components that are containers for a multitude of things. Lost potential?
-https://twitter.com/UXtechnologist

@loganvolkers
Copy link

How would a developer provide this information?

@thepassle for our purposes we would use a custom JSDocs Tags with Stencil.

/**
 * @slot tabs - Tab bodies
 * @slotChildren tabs: tab-items
 */

Is there a way to fully require this at runtime? The listing would be more of a suggestion, right? In this way maybe expectedChildren might be more correct? Accepting selector strings, or base classes would be very interesting.

This is a suggestion in the same way that only putting a td in tr is a suggestion. Obviously you can structure it differently, but it won't do what you want.

The HTML spec is litered with these kinds of things:

  • dl, dd, and dt
  • details and summary
  • table etc.

Here you apply a type to the attribute, it would be interesting to be able to add a element type and/or tag name

@Westbrook this seems a little bit overly complex having both the selector and type information

@justinfagnani
Copy link
Collaborator

I think these types of discussions should be had on an issue, and not in a PR. If someone wants to open an issue for this. (the HTML spec has the concept of "content models" btw: https://html.spec.whatwg.org/multipage/dom.html#content-models)

@jogibear9988
Copy link
Contributor Author

There is an issue: #46

@justinfagnani
Copy link
Collaborator

There is an issue: #46

Thanks. I didn't notice that linked.

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

Successfully merging this pull request may close these issues.

5 participants