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 Web Components

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

UX Team Write once, use anywhere Framework agnostic Design Systems with Web Components We need our own, customized UI library

Slide 8

Slide 8 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 Web Components

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

• A collection of experiences (Do’s and Don’ts) • Pattern & Component Library • Styleguide (The foundation of the design process) • Design language What is a Design System Write once, use anywhere Framework agnostic Design Systems with Web Components

Slide 12

Slide 12 text

• Visual consistency within on (or many) application(s) • Common basis for product owner, marketing, design and development • Create an interface between design & development • Quicker implementation of new features What are the goals? Write once, use anywhere Framework agnostic Design Systems with Web Components

Slide 13

Slide 13 text

Which ones do exist? Write once, use anywhere Framework agnostic Design Systems with Web Components

Slide 14

Slide 14 text

What does it consist of? Write once, use anywhere Framework agnostic Design Systems with Web Components Tokens md.sys.color.primary md.sys.color.on-primary md.sys.typescale.display-l md.sys.typescale.display-s Typography Display Headline Title Body Colors Primary Secondary Tertiary Background Elevations 0dp 1dp 2dp 3dp States enabled disabled Layout Gaps Margins Paddings Border-Radius Motion Design

Slide 15

Slide 15 text

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

Slide 16

Slide 16 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 Web Components

Slide 17

Slide 17 text

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

Slide 18

Slide 18 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 Web Components

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

Beispielanwendung animieren

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 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 Web Components

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 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 Web Components

Slide 29

Slide 29 text

Beispielanwendung animieren

Slide 30

Slide 30 text

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

Slide 31

Slide 31 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 Web Components

Slide 32

Slide 32 text

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