Component
From BC$ MobileTV Wiki
(Redirected from WebComponents)
WebComponents are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. Custom components and widgets build on the Web Component standards, will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.
WebComponents are based on existing web standards. Features to support web components are currently being added to the HTML and DOM specs, letting web developers easily extend HTML with new elements with encapsulated styling and custom behavior.
Contents
Specifications
- WebComponents spec: https://www.webcomponents.org/specs
- HTML5 - Custom elements: https://w3c.github.io/webcomponents/spec/custom/
- HTML5 - Shadow DOM: https://w3c.github.io/webcomponents/spec/shadow/
- HTML5 - Template element: https://html.spec.whatwg.org/multipage/scripting.html#the-template-element
- HTML5 - import spec: https://w3c.github.io/webcomponents/spec/imports/
- CSS modules: https://www.sitepoint.com/understanding-css-modules-methodology/
Custom Elements
- Custom Elements v1 -- Reusable Web Components: https://developers.google.com/web/fundamentals/web-components/customelements
- WebComponents - Custom Elements in detail: https://flaviocopes.com/web-components-custom-elements/
Shadow DOM
- Shadow DOM polyfill: https://webcomponents.github.io/polyfills/shadow-dom/[3]
- MozDev -- WebComponents - Using shadow DOM: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
- GoogleDev -- Shadow DOM v1 - Self-Contained Web Components: https://developers.google.com/web/fundamentals/web-components/shadowdom
Templates
- MozDev -- WebComponents - Using template & slot: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots
CSS modules
- CSS modules official docs: https://github.com/css-modules/css-modules
- Styling Web Components Using A Shared Style Sheet: https://www.smashingmagazine.com/2016/12/styling-web-components-using-a-shared-style-sheet/
- Styling the Shadow DOM, or, a metaphor gone too far: https://meowni.ca/posts/styling-the-dome/
- Getting Started with CSS Modules: https://css-tricks.com/css-modules-part-2-getting-started/
EXAMPLES
- WebComponents - Paper Button: https://www.webcomponents.org/element/PolymerElements/paper-button
- WebComponents - Timer: https://www.webcomponents.org/element/TherapyChat/time-counter
Design Systems
- Pluralsight -- Design System: https://design-system.pluralsight.com
- Okta -- Odyssey Design System: https://odyssey.okta.design/[9]
"Living" Style Guides
Component Catalogs
- Starbucks Pattern Library: https://www.starbucks.com/developer/pattern-library/components/carousel/
- Salesforce - "Lightning Web Components" (LWC) catalog: https://developer.salesforce.com/docs/component-library/overview/components
Tools
- Publish your WebComponent to share with community: https://www.webcomponents.org/publish
- Cross-platform WebComponent "marketplace": https://bit.dev
Libraries
- Polymer project: https://www.polymer-project.org/ | DEMO[23]
- Ionic: https://ionicframework.com/ | DEMO[24][25]
- ExtWebComponents: https://www.sencha.com/products/extwebcomponents/evaluate/earlyaccess/ | SRC[26][27]
Design Systems
- Stencil.JS: https://stenciljs.com/ (magical, reusable WebComponent compiler from Ionic)
- Storybook.js: https://storybook.js.org/
- InVision -- Design System Manager (DSM): https://www.invisionapp.com/design-system-manager
- Svelte -- "cybernetically enhanced" web apps: https://svelte.dev (compile-time framework for WebComponents)
- SkateJS - SSR for WebComponents: https://github.com/skatejs/skatejs/tree/master/packages/ssr (Web Component Server-Side Rendering & testing)
Resources
- Web Components intro: https://www.webcomponents.org/introduction
- WebComponents - polyfills: https://github.com/webcomponents/polyfills/
- CustomElements everywhere: https://custom-elements-everywhere.com/ (compatibility of WebComponents with particular JS frameworks)
- Mozilla Dev resources -- WebComponents: https://developer.mozilla.org/en-US/docs/Web/Web_Components | EXAMPLES
- Google developers -- Custom Element Best Practices: https://developers.google.com/web/fundamentals/web-components/best-practices
- Custom Element Best Practices: https://developers.google.com/web/fundamentals/web-components/best-practices
- Open Web Components: https://open-wc.org/
- Web Component Essentials (E-Book): https://webcomponent.dev
- WebComponents the Right Way: https://github.com/mateusortiz/webcomponents-the-right-way (curated list of awesome Web Components resources)
- LitHTML: https://lit-html.polymer-project.org | SRC | NPM | UNPKG (efficient, expressive, extensible HTML templates in JavaScript)
- LitElement: https://lit-element.polymer-project.org/ | SRC | NPM | UNPKG (simple base class for creating fast, lightweight web components with lit-html)
- Material Design - WebComponents: https://github.com/material-components/material-components-web-components
- Gluon: | SRC | NPM | [unpkg.com/gluon@latset/gluon.js UNPKG] (NodeJS project manager... managing routes, which event goes first, models and DB connection)
- "Lightning" Web Components: (not to be confused with LitHTML/LitElement)
- Adopting a Unified Component Library Strategy: https://www.sencha.com/resources/whitepaper/adopting-a-unified-component-library-strategy/
Tutorials
- WebComponent "kitchen sink" tutorial: https://component.kitchen/tutorial
- Custom Elements v1 -- Reusable Web Components: https://developers.google.com/web/fundamentals/web-components/customelements[32]
- How to Create Your Own HTML Elements With Web Components: https://webdesign.tutsplus.com/articles/how-to-create-your-own-html-elements-with-web-components--cms-21524
- A Guide to Web Components: https://css-tricks.com/modular-future-web-components/
- Web Components by Example (tutorial series): Part 1 | Part 2 | Part 3 | Part 4 | Part 5
- Let's Build Web Components! (tutorial series): Part 1 - Standards | Part 2 - Polyfills | Part 3 - Vanilla Components | Part 4 - Polymer lib | Part 5 - LitElement | Part 6 - Gluon lib | Part 7 - Hybrids | Part 8 - Mythbusting[33]
- Web Components - from zero to hero (tutorial series): https://thepassle.github.io/webcomponents-from-zero-to-hero/ | SRC
- Understanding Web Standards — Shadow DOM and Custom HTML Elements: https://dzone.com/articles/understanding-web-standards-shadow-dom-and-custom
- "howto-checkbox" WebComponent walkthrough: https://googlechromelabs.github.io/howto-components/howto-checkbox/#demo
- React + WebComponents: https://reactjs.org/docs/web-components.html
- Create & Publish Web Components With Vue CLI 3: https://vuejsdevelopers.com/2018/05/21/vue-js-web-component/
[37] [38] [39] [40] [41] [42] [43] [44]
- How JavaScript works -- the internals of Shadow DOM + how to build self-contained components: https://blog.sessionstack.com/how-javascript-works-the-internals-of-shadow-dom-how-to-build-self-contained-components-244331c4de6e
- Do we still need JavaScript frameworks?: https://medium.freecodecamp.org/do-we-still-need-javascript-frameworks-42576735949b (a look at developing a Component-based SPA using only WebComponents)
- LitElement with Typescript, cannot access shadowRoot doms: https://stackoverflow.com/questions/58310778/litelement-with-typescript-cannot-access-shadowroot-doms
- Introduction To Web Components (Up/Down Counter component): https://coryrylan.com/blog/introduction-to-web-components | DEMO
- Communication between Components (universal): https://hackernoon.com/communication-between-components-7898467ce15b[45][46][47][48][49][50][51][52]
- How to listen for custom events defined WebComponent: https://stackoverflow.com/questions/43061417/how-to-listen-for-custom-events-defined-web-component
- Introduction To Web Components: https://coryrylan.com/blog/introduction-to-web-components
- Building Web Components with lit-html: https://coryrylan.com/blog/building-web-components-with-lit-html
- Shadow DOM Usage in Ionic Web Components: https://www.joshmorony.com/shadow-dom-usage-in-ionic-web-components/
- WebComponents integration using LitElement & TypeScript: https://labs.thisdot.co/blog/web-components-integration-using-litelement-and-typescript
External Links
- wikipedia: Web Components
- wikipedia: Component-based software engineering
- Bringing "componentization" to the web -- An overview of Web Components: https://blogs.windows.com/msedgedev/2015/07/14/bringing-componentization-to-the-web-an-overview-of-web-components/
- Web Components will fulfill the promise of "Modular xHTML": https://www.symfony.fi/entry/web-components-will-fulfill-the-promise-of-modular-xhtml
- Long-term Web Semantics: https://infrequently.org/2013/11/long-term-web-semantics/
- The broken promise of Web Components: https://dmitriid.com/blog/2017/03/the-broken-promise-of-web-components/
- Pros and Cons of Facebook's React vs. Web Components (Polymer): https://softwareengineering.stackexchange.com/questions/225400/pros-and-cons-of-facebooks-react-vs-web-components-polymer
- React + Performance = ?: https://aerotwist.com/blog/react-plus-performance-equals-what/ (compares ReactJS .vs. Vanilla JS... React was slower and less performant in pretty much all cases)
- What happened to Web Components?: http://2ality.com/2015/08/web-component-status.html (1st pass of technology already deprecated in favor of new but similar approaches, to be combined to HTML5 family of specs)
- Web Components v1 - the next generation: https://developers.google.com/web/updates/2017/01/webcomponents-org
- Sharing Polymer Components -- part 1: https://code.tutsplus.com/tutorials/sharing-polymer-components-part-1--cms-21264
- YouTube is being rebuilt with Web Components & Polymer: https://react-etc.net/entry/youtube-is-being-rebuilt-on-web-components-and-polymer
- Categorizing Components Into Smart & Dumb Components, in React: https://alligator.io/react/smart-dumb-components/
- Web Components will replace your frontend framework: https://blog.usejournal.com/web-components-will-replace-your-frontend-framework-3b17a580831c (includes a good <lazy-img> WebComponent example)
- Build Your Next Design System with Web Components: https://blog.ionicframework.com/build-your-next-design-system-with-web-components/
- Web Components in 2018 : http://web.archive.org/web/20180706163218/https://www.sitepen.com/blog/2018/07/06/web-components-in-2018/
- 3 Trends That Will Impact Your Mobile Dev Strategy in 2019: https://ionicpro.wistia.com/medias/y5oz6i1s1q
- 2018 - The Year of Web Components - Dominik Kundel: https://www.youtube.com/watch?v=SgnE3p1qF-c
- Why I use Web Components - My use cases: https://dev.to/shihn/why-i-use-web-components-my-use-cases-1nip
- Why We Use Web Components: https://dev.to/ionic/why-we-use-web-components-2c1i?
- Why I don't use Web Components: https://dev.to/richharris/why-i-don-t-use-web-components-2cia
- The Agony and the Ecstasy of Web Components and the Shadow DOM: https://rigor.com/blog/web-components-shadow-dom
- Demythstifying Web Components: http://www.backalleycoder.com/2016/08/26/demythstifying-web-components/
- Web Component "HelloWorld" example using VanillaJS: https://github.com/webcomponents/hello-world-element | DEMO | SRC - Hello LitElement[58]
- 5 Signs That Your Shared-Asset Strategy Is Broken: https://blog.newrelic.com/engineering/shared-asset-strategy/
- TalkScript podcast -- Episode 37 - Stencil & Using TypeScript to Build Web Components: https://www.sitepen.com/blog/episode-37-stencil-using-typescript-to-build-web-components/
- Introducing ECSY: an Entity Component System framework for the Web: https://blog.mozvr.com/introducing-ecsy/
- The Firefox UI is now built with Web Components: https://briangrinstead.com/blog/firefox-webcomponents/
- The Case for Versioning Independent UI Components: https://blog.bitsrc.io/versioning-independent-ui-components-why-and-how-7ea60d8be5f2
- It's not about Web Components .vs. React: https://dev.to/steveblue/it-s-not-about-web-components-vs-react-5137
- Context-Aware Web Components Are Easier Than You Think: https://css-tricks.com/context-aware-web-components/
- UI Components - They Are Not As Difficult As You Think: https://www.sencha.com/blog/ui-components-they-are-not-as-difficult-as-you-think/
References
- ↑ The Case for Custom Elements -- Part 1: https://medium.com/dev-channel/the-case-for-custom-elements-part-1-65d807b4b439
- ↑ The Case for Custom Elements -- Part 2: https://medium.com/dev-channel/the-case-for-custom-elements-part-2-2efe42ce9133
- ↑ Shadow DOM polyfill: https://www.webcomponents.org/polyfills/shadow-dom/
- ↑ Shadow DOM CSS Cheat Sheet: https://web.archive.org/web/20141205183548/https://robdodson.me/blog/2014/04/10/shadow-dom-css-cheat-sheet/
- ↑ An Introduction to CSS-in-JS -- Examples, Pros & Cons: https://webdesign.tutsplus.com/articles/an-introduction-to-css-in-js-examples-pros-and-cons--cms-33574
- ↑ "Styled Components" project: https://styled-components.com/ | DOCS | SRC (React/web & ReactNative/mobile styling framework)
- ↑ Aphrodite framework: https://github.com/Khan/aphrodite(framework-agnostic "CSS-in-JS" with support for server-side rendering, browser prefixing, and minimum CSS generation)
- ↑ Inline CSS at Khan Academy - Aphrodite: https://blog.khanacademy.org/inline-css-at-khan-academy-aphrodite/
- ↑ Okta launches its new open-source design system with a focus on accessibility: https://techcrunch.com/2021/02/04/okta-launches-its-new-open-source-design-system-with-a-focus-on-accessibility/?guccounter=1
- ↑ The State of Design Systems (2020): https://material.io/blog/research-state-of-design-systems-2020
- ↑ Avoiding the Pitfalls of "Nested Components" in a Design System: https://css-tricks.com/nested-components-in-a-design-system/
- ↑ The Era of Design Systems Is Gone: https://onchky.medium.com/the-era-of-design-systems-is-gone-f61f97cd8e86
- ↑ Documentation—the Key to a Successful Design System: https://xd.adobe.com/ideas/principles/design-systems/documentation-key-to-successful-design-system/
- ↑ Design Systems: https://xd.adobe.com/ideas/principles/design-systems/
- ↑ A Maintainable Style Guide: http://engineering.lonelyplanet.com/2014/05/18/a-maintainable-styleguide.html
- ↑ CSS specificity -- main things you should know: https://www.smashingmagazine.com/2007/07/css-specificity-things-you-should-know/
- ↑ CSS Specificity for "poker" players: https://carl.camera/?id=95
- ↑ Specificity Calculator: https://specificity.keegan.st
- ↑ Salesforce "trailhead" - Build Lightning Web Components (E-learning module): https://trailhead.salesforce.com/en/content/learn/trails/build-lightning-web-components
- ↑ Salesforce -- LWC "Design System" - Date Picker example: https://www.lightningdesignsystem.com/components/datepickers/
- ↑ Salesforce -- Developer Quick Takes - explaining the "Shadow DOM": https://www.youtube.com/watch?v=K5i9zMzVlzM
- ↑ Salesforce -- Developer Quick Takes - Custom Elements & HTML Templates: https://www.youtube.com/watch?v=6rK3AyxE-54
- ↑ What is the Polymer project: (Google's OSS reference implementation of WebComponents)
- ↑ Ionic -- App Showcase (major applications developed in Ionic): https://showcase.ionicframework.com/apps/top
- ↑ Ionic 4 tutorial -- Mastering Web Components in Ionic 4: https://ionicthemes.com/tutorials/about/ionic-4-tutorial-mastering-web-components-in-ionic-4
- ↑ ExtWebComponents - Early Access is Now Available: https://www.sencha.com/blog/extwebcomponents-early-access-is-now-available/
- ↑ Sencha Roadmap Update – September 2019: https://www.sencha.com/blog/sencha-roadmap-update-2019/ (ExtJS-WebComponents the path forward for Sencha)
- ↑ 9 Web Components UI Libraries You Should Know in 2019: https://blog.bitsrc.io/9-web-component-ui-libraries-you-should-know-in-2019-9d4476c3f103
- ↑ 7 Tools for Developing Web Components in 2019: https://dev.to/giteden/7-tools-for-developing-web-components-in-2019-1ld6
- ↑ My first Svelte component on NPM — and why it’s a big deal: https://medium.com/@u_glow/my-first-svelte-component-on-npm-and-why-its-a-big-deal-c4568f52de97
- ↑ Applitools - Roadmap to Testing a Design System – by Marie Drake (WEBINAR): https://applitools.com/blog/roadmap-testing-design-system/
- ↑ Polyfills and Transpilation for Your Custom Elements: https://alligator.io/web-components/polyfills-transpilation/
- ↑ Should you build a reusable “Component Library”?: https://mcapoz.medium.com/should-you-build-a-reusable-component-library-4e7df72413d7
- ↑ Complementarity of React and Web Components: https://www.webcomponents.org/community/presentations/complementarity-of-react-and-web-components-at-reactjs-conf
- ↑ How to Build Faster with Reusable UI Components in React: https://codeburst.io/how-to-build-faster-with-reusable-ui-components-in-react-482397dec818 (an overview from a co-founder of "Bit" component catalog)
- ↑ How to Achieve Reusability with React Components: https://medium.com/walmartglobaltech/how-to-achieve-reusability-with-react-components-81edeb7fb0e0
- ↑ Integrate Web Components with Your Vue.js App: https://alligator.io/vuejs/vue-integrate-web-components/
- ↑ How to use Web Components in Vue: https://vaadin.com/learn/tutorials/using-web-components-in-vue
- ↑ Vue.js -- Single File Components: https://vuejs.org/v2/guide/single-file-components.html
- ↑ vue.js components - WebComponents wrapper: https://github.com/vuejs/vue-web-component-wrapper
- ↑ Create Web Components with Vue.js: https://dev.to/aumayeung/create-web-components-with-vue-js-2bb0
- ↑ Agile Design Systems in Vue: https://www.vuemastery.com/conferences/vueconf-2018/agile-design-systems-in-vue-miriam-suzanne
- ↑ Custom Elements support: https://vuegwt.github.io/vue-gwt/guide/advanced/custom-elements.html
- ↑ Composing with Components: https://v3.vuejs.org/guide/introduction.html#composing-with-components
- ↑ Distributed Event-based Communication for Web Components: https://www.researchgate.net/publication/305208920_Distributed_Event-based_Communication_for_Web_Components | DEMO
- ↑ WebComponents in PROD: https://news.ycombinator.com/item?id=17297065
- ↑ Lightning Inter-Component Communication Patterns: https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html
- ↑ Inter-Component Communication with Aurelia: https://sean-hunter.io/2016/10/23/inter-component-communication-with-aurelia/
- ↑ Making Web Components Work: https://engineering.mixpanel.com/2018/06/12/making-web-components-work/
- ↑ How to communicate between Web Components (native UI)?: https://stackoverflow.com/questions/55001211/how-to-communicate-between-web-components-native-ui
- ↑ Five reasons why Web Components could complement JavaScript frameworks: https://medium.com/javascript-in-plain-english/could-web-components-actually-compliment-javascript-frameworks-5-reasons-why-i-think-so-971eee82ee85
- ↑ How to communicate between Components: https://www.freecodecamp.org/news/how-to-communicate-between-components-b48ef70bf913/
- ↑ Try a legacy Web Components 1.0 example: http://jsbin.com/roripoveku/edit?html,output
- ↑ Comprehensive set of high-quality web components for common user interface patterns: https://github.com/basic-web-components/basic-web-components
- ↑ OC components examples, covering the most common use cases: https://github.com/opencomponents/oc-components-examples
- ↑ OpenTable - Open Components: https://github.com/opentable/oc
- ↑ Open components as microservices in the front-end world: https://conferences.oreilly.com/velocity/devops-web-performance-eu-2015/public/schedule/detail/44289
- ↑ Writing a hello world WebComponent: https://apimeister.com/2017/06/03/writing-a-hello-world-web-component.html
See Also
Widgets | RIA | SPA | AEM | HTML/CSS/JS | HTML5#WebComponents | Web | Design | A11Y