[w3c/webcomponents] Declarative components proposal (#897)

Today to create a web component we have to write a piece of JavaScript code just to register a custom element. Web component needs to give a next step. If we want people to use it more we should let them create small components without friction. A small component is just a custom element for encapsulating template and/or style, no JS required.

A declarative way to define custom elements appears to solve the problem above. Some proposals has already been made, but apparently, none has evolved.

I've been doing some experiments on this topic and I've created a polyfill for the tag `<component>` which can be the wrapper for declarative define a custom element.

Imagine you can define a custom element like this:

```html
<component name="alert-box" extends="p">
  <style>
    p {
      color: #FFF;
      background-color: #3778e5;
      border-radius: 6px;
      padding: 5px 15px;
    }
  </style>
</component>

<alert-box>some cool text!</alert-box>
```

You can find several live examples using the polyfill [here](https://tag-components.vercel.app).

I would like to invite some people to join the conversation:
@ebidel, @rniwa, @trusktr

What do you think?

Thanks
 

You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/webcomponents/pull/897

-- Commit Summary --

  * add declarative components proposal

-- File Changes --

    A proposals/Declarative-Components.md (102)

-- Patch Links --

https://github.com/w3c/webcomponents/pull/897.patch
https://github.com/w3c/webcomponents/pull/897.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/pull/897

Received on Tuesday, 20 October 2020 00:52:11 UTC