export default class xxx extends HTMLElement, xxx should be named:
- Each class name should start with
WC_, which means the first letter ofWeb Components. - After
WC_, the first letter of each word should be capitalized. - There is no spaces or punctuation within each word.
- Other than
WC_, it corresponds toUpper Camel Case(also calledPascal) naming convention.
For example:
- WC_Button
- WC_Alerts
- WC_ProgressBar
- ...
<xxx></xxx>, xxx should be named:
- all letters should be lower case.
- each word should be joined with a dash symbol
-.
For example:
- WC_Button -> wc-button ->
<wc-button></wc-button> - WC_Alerts -> wc-alerts ->
<wc-alerts></wc-alerts> - WC_ProgressBar -> wc-progress-bar ->
<wc-progress-bar></wc-progress-bar> - ...
<wc-button data-xxx='yyy'></wc-button>
/* CSS */// JavaScript<div part='xxx'></div>, xxx should be named:
<slot name='xxx'></slot>, xxx should be named:
Notice: slot name attribute value may be the same as light DOM element slot attribute value:
<slot name='slot'></slot> matches <div slot='slot'></div>.
--xxx-yyy, xxx means CSS Selectors while yyy means CSS property.