Slide 1

Slide 1 text

Write once, use anywhere Framework agnostic Design Systems with Web Components Sascha Lehmann @derLehmann_S Consultant

Slide 2

Slide 2 text

Consultant @ Thinktecture AG Sascha Lehmann @derLehmann_S [email protected] https://www.thinktecture.com/thinktects/sascha-lehmann/  ✉  Write once, use anywhere Framework agnostic Design Systems with Components

Slide 3

Slide 3 text

What is the problem? Write once, use anywhere Framework agnostic Design Systems with Components

Slide 4

Slide 4 text

DEV Team Product / POC Write once, use anywhere Framework agnostic Design Systems with Components

Slide 5

Slide 5 text

Write once, use anywhere Framework agnostic Design Systems with Components

Slide 6

Slide 6 text

DEV Team Product UX Team Write once, use anywhere Framework agnostic Design Systems with Components

Slide 7

Slide 7 text

• Is there a company-wide regulation as to which framework is used, or can each team decide freely according to developer composition/experience? • Are there any external service providers or agencies on board? • Are there CMS systems that also need to be supplied? • Etc. What questions need to be asked? Write once, use anywhere Framework agnostic Design Systems with Components

Slide 8

Slide 8 text

Web Components P Write once, use anywhere Framework agnostic Design Systems with Components

Slide 9

Slide 9 text

… but based on existing standards No web standard of its own… Custom Elements ES Modules Shadow DOM HTML Templates Write once, use anywhere Framework agnostic Design Systems with Components

Slide 10

Slide 10 text

How they are declared Custom Elements Write once, use anywhere Framework agnostic Design Systems with Components

Slide 11

Slide 11 text

document node node node Shadow Host Shadow DOM Shadow Root node node node Shadow DOM Write once, use anywhere Framework agnostic Design Systems with Components

Slide 12

Slide 12 text

Vanilla or Library? Write once, use anywhere Framework agnostic Design Systems with Components

Slide 13

Slide 13 text

Frameworks Libraries Write once, use anywhere Framework agnostic Design Systems with Components

Slide 14

Slide 14 text

Structure projects Write once, use anywhere Framework agnostic Design Systems with Components

Slide 15

Slide 15 text

Beispielanwendung animieren

Slide 16

Slide 16 text

Cutting components Architecture Write once, use anywhere Framework agnostic Design Systems with Components

Slide 17

Slide 17 text

Input Element A naive first try… Usage Write once, use anywhere Framework agnostic Design Systems with Components

Slide 18

Slide 18 text

Downsides A naive first try … • We "hide" or encapsulate everything in the component • This results in poor maintainability • Configuration must be controlled via many inputs • The shadow DOM makes accessibility more difficult • Frameworks do not automatically recognize the component as a form element • We lose the browser default behavior Write once, use anywhere Framework agnostic Design Systems with Components

Slide 19

Slide 19 text

“Never reimplement what the Browser already implements for you!” Write once, use anywhere Framework agnostic Design Systems with Components

Slide 20

Slide 20 text

Use the power of slotting / Contentprojection A second approach … Usage Write once, use anywhere Framework agnostic Design Systems with Components

Slide 21

Slide 21 text

Benefits A second approach … • The „native“ HTML elemets remain in the light DOM ü Default behavior of elements remains ü Accessebility can be guaranteed ü No fremework specific wrappers needed • Higher flexibility ü No „input-hell“ ü Easier maintanance ü Component defines the structure Write once, use anywhere Framework agnostic Design Systems with Components

Slide 22

Slide 22 text

Beispielanwendung animieren

Slide 23

Slide 23 text

Everything at a glance Do’s & Don’ts Write once, use anywhere Framework agnostic Design Systems with Components

Slide 24

Slide 24 text

• Check the project environment in detail at the beginning • Decide on a library or framework • Familiarize yourself with the basic technology • Set up a clean project structure • Keep components small and lightweight • Use slotting / content projection to increase flexibility • Lively exchange with UI/UX team • Don’t reimplement what the browser already implements for you • Encapsulate everything in the component • Mixing several responsibilities in one component • Being driven by project preassure Do’s Don’ts Write once, use anywhere Framework agnostic Design Systems with Components

Slide 25

Slide 25 text

Sascha Lehmann [email protected] Thank you very much! @derLehmann_S [email protected] https://www.thinktecture.com/thinktects/sascha-lehmann/  ✉ 