SlideShare a Scribd company logo
there be light
Ilya Gorenburg
Frontend Developer at .
State of frameworks
3
Projects are .
The problem
Community Forum
Web Components
Web components 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.
Source: https://www.webcomponents.org/introduction
Can I use?
Example of web component code
<script type="module" src="./motion-carousel.js"></script>
<motion-carousel id="carousel">
<img src="https://picsum.photos/seed/1/200">
<img src="https://picsum.photos/seed/2/200">
<img src="https://picsum.photos/seed/3/200">
</motion-carousel>
Define web component
How to kickstart
Vanilla JS
Frameworks*
- Stencil
- Lit
- Hybrids
- Contextful Web Components Library
- Slim.js (Outdated)
- Skate.js (Outdated)
- Polymer (Deprecated in favor of Lit)
Why Lit?
Lit Stencil
Solution type Library Compiler*
Typescript ✅ ✅
Templates Declarative templates JSX
Virtual DOM ✅** ✅
Server Side Rendering ✅ ✅
Testing Jest, Karma, Mocha, Jasmine, Web
Test Runner
Jest
Localization ✅** Plug-in / Custom solutions
Tree-shaking ✅ ❌
Lit vs Stencil
Features showcase
Vite Lit TS Starter
$ yarn create vite
Project structure
webcomponent/
├─ dist/
├─ node_modules/
├─ public/
├─ src/
│ ├─ index.css
│ ├─ my_element.ts
├─ types/
├─ .gitignore
├─ tsconfig.json
├─ index.html
├─ vite.config.ts
├─ package.json
Basic Lit Component
Property bindings
Context
Localization
Runtime Transform
● Native support for expressions and HTML markup inside localized templates. No need for a
new syntax and interpolation runtime for variable substitution—just use the templates you
already have.
● Automatic re-rendering of Lit components when the locale switches.
● Only 1.27 Kb (minified + compressed) of extra JavaScript.
● XLIFF localization files.
Modes
Localization
Subcomponents
Shadow DOM
Moving CSS Out of Component
Styling the block
Web Component Inherited CSS
Most common:
● color
● cursor
● direction
● font
● font-* (font-family, font-size etc.)
● letter-spacing
● line-height
● text-align
● text-indent
● text-transform
● visibility
● word-spacing
Full list: W3.org
Integration with Angular
Or any other framework
Good to know
Using images
Any type: inline or external
Icon Fonts
Tricky, but doable
External API Requests
Just use fetch()
Localstorage
Same access as the rest of the javascript
External CSS
Yes, but not recommended by Lit team
…and
It’s just a javascript. Do what you want to do 🎉
Bundle size
Framework Time to Interactive Eager JS KiB Total KiB
Angular 1.6s 72Kb 74Kb
Lit 0.8s 16Kb 18Kb
Next 2.2s 83Kb 94Kb
Nuxt 3 1.5s 50Kb 55Kb
React 0.8s 150Kb 171Kb
Svelte 1.5s 19Kb 24Kb
Vue 3 1.2s 33Kb 41Kb
Source: https://github.com/BuilderIO/framework-benchmarks#todo-app
Resources
- Use web components for what they’re good at
https://nolanlawson.com/2023/08/23/use-web-components-for-what-theyre-good-at/
- Custom Elements Everywhere
https://custom-elements-everywhere.com/
- A curated list of awesome Web Components resources:
https://github.com/web-padawan/awesome-web-components
- All the Ways to Make a Web Component:
https://webcomponents.dev/blog/all-the-ways-to-make-a-web-component/
- Web Components Today:
https://webcomponents.today/
- Moving from Stencil to LitElement:
https://www.abeautifulsite.net/posts/moving-from-stencil-to-lit-element/
- Framework Benchmarks:
https://github.com/BuilderIO/framework-benchmarks
- A curated list of awesome Lit resources:
https://github.com/web-padawan/awesome-lit
- Building UI components in DevTools with Custom Elements:
https://goo.gle/building-ui-devtools
- Google Material Components:
https://github.com/material-components/material-web
- Handling data with Web Components
https://itnext.io/handling-data-with-web-components-9e7e4a452e6e
Thank you
Web: ilya.gorenburg.com
Twitter: @gorenburg

More Related Content

Similar to Lit there be light

Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
zonathen
 
Coding the UI
Coding the UICoding the UI
Coding the UI
Mark Meeker
 
Coding Ui
Coding UiCoding Ui
Coding Ui
rajivmordani
 
Training presentation.pptx
Training presentation.pptxTraining presentation.pptx
Training presentation.pptx
NishchaiyaBayla1
 
Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3
Karambir Singh Nain
 
SPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFxSPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFx
NCCOMMS
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
Bob German
 
A Complete Guide to Frontend - UI Developer
A Complete Guide to Frontend - UI DeveloperA Complete Guide to Frontend - UI Developer
A Complete Guide to Frontend - UI Developer
nariyaravi
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
Deblina Chowdhury
 
Java script
Java scriptJava script
Java script
umesh patil
 
Java script
Java scriptJava script
Java script
sanjay joshi
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
Gurpreet singh
 
Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1
Paxcel Technologies
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
Gopi A
 
Web Development Today
Web Development TodayWeb Development Today
Web Development Today
bretticus
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
Nilesh Bafna
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
Brian Moon
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
netc2012
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | Introduction
JohnTaieb
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 

Similar to Lit there be light (20)

Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Coding the UI
Coding the UICoding the UI
Coding the UI
 
Coding Ui
Coding UiCoding Ui
Coding Ui
 
Training presentation.pptx
Training presentation.pptxTraining presentation.pptx
Training presentation.pptx
 
Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3
 
SPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFxSPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFx
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
A Complete Guide to Frontend - UI Developer
A Complete Guide to Frontend - UI DeveloperA Complete Guide to Frontend - UI Developer
A Complete Guide to Frontend - UI Developer
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
 
Java script
Java scriptJava script
Java script
 
Java script
Java scriptJava script
Java script
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Web Development Today
Web Development TodayWeb Development Today
Web Development Today
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | Introduction
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 

Recently uploaded

Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 

Recently uploaded (20)

Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 

Lit there be light

  • 3.
  • 4.
  • 10. Web components 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. Source: https://www.webcomponents.org/introduction
  • 12. Example of web component code <script type="module" src="./motion-carousel.js"></script> <motion-carousel id="carousel"> <img src="https://picsum.photos/seed/1/200"> <img src="https://picsum.photos/seed/2/200"> <img src="https://picsum.photos/seed/3/200"> </motion-carousel>
  • 14. How to kickstart Vanilla JS Frameworks* - Stencil - Lit - Hybrids - Contextful Web Components Library - Slim.js (Outdated) - Skate.js (Outdated) - Polymer (Deprecated in favor of Lit)
  • 16.
  • 17. Lit Stencil Solution type Library Compiler* Typescript ✅ ✅ Templates Declarative templates JSX Virtual DOM ✅** ✅ Server Side Rendering ✅ ✅ Testing Jest, Karma, Mocha, Jasmine, Web Test Runner Jest Localization ✅** Plug-in / Custom solutions Tree-shaking ✅ ❌ Lit vs Stencil
  • 19. Vite Lit TS Starter $ yarn create vite
  • 20. Project structure webcomponent/ ├─ dist/ ├─ node_modules/ ├─ public/ ├─ src/ │ ├─ index.css │ ├─ my_element.ts ├─ types/ ├─ .gitignore ├─ tsconfig.json ├─ index.html ├─ vite.config.ts ├─ package.json
  • 24. Localization Runtime Transform ● Native support for expressions and HTML markup inside localized templates. No need for a new syntax and interpolation runtime for variable substitution—just use the templates you already have. ● Automatic re-rendering of Lit components when the locale switches. ● Only 1.27 Kb (minified + compressed) of extra JavaScript. ● XLIFF localization files. Modes
  • 28. Moving CSS Out of Component
  • 30. Web Component Inherited CSS Most common: ● color ● cursor ● direction ● font ● font-* (font-family, font-size etc.) ● letter-spacing ● line-height ● text-align ● text-indent ● text-transform ● visibility ● word-spacing Full list: W3.org
  • 31. Integration with Angular Or any other framework
  • 33. Using images Any type: inline or external
  • 36. Localstorage Same access as the rest of the javascript
  • 37. External CSS Yes, but not recommended by Lit team
  • 38. …and It’s just a javascript. Do what you want to do 🎉
  • 39. Bundle size Framework Time to Interactive Eager JS KiB Total KiB Angular 1.6s 72Kb 74Kb Lit 0.8s 16Kb 18Kb Next 2.2s 83Kb 94Kb Nuxt 3 1.5s 50Kb 55Kb React 0.8s 150Kb 171Kb Svelte 1.5s 19Kb 24Kb Vue 3 1.2s 33Kb 41Kb Source: https://github.com/BuilderIO/framework-benchmarks#todo-app
  • 40. Resources - Use web components for what they’re good at https://nolanlawson.com/2023/08/23/use-web-components-for-what-theyre-good-at/ - Custom Elements Everywhere https://custom-elements-everywhere.com/ - A curated list of awesome Web Components resources: https://github.com/web-padawan/awesome-web-components - All the Ways to Make a Web Component: https://webcomponents.dev/blog/all-the-ways-to-make-a-web-component/ - Web Components Today: https://webcomponents.today/ - Moving from Stencil to LitElement: https://www.abeautifulsite.net/posts/moving-from-stencil-to-lit-element/ - Framework Benchmarks: https://github.com/BuilderIO/framework-benchmarks - A curated list of awesome Lit resources: https://github.com/web-padawan/awesome-lit - Building UI components in DevTools with Custom Elements: https://goo.gle/building-ui-devtools - Google Material Components: https://github.com/material-components/material-web - Handling data with Web Components https://itnext.io/handling-data-with-web-components-9e7e4a452e6e