Replies: 2 comments
-
ChatGPT: convert to decision tree |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
HTML/CSS component vs. web component
HTML/CSS
Web Components
Recommendation: Use standard elements if it's possible to build the component with one element (
<a>, <p>, <h1>
). Use a custom element when JS functionality is necessary (<post-accordion>, <post-tabs>
), when a specific structure is necessary (<post-input>, <post-input floating-label>
) or there is no standard element for the use case (<post-tag>
). Exceptions or edge cases are possibly a<button>
with icon where it's hard to implement a button with all necessary variations and compatibility as web component but a specific nesting structure is necessary.Shadow vs. Light DOM
Light DOM
:has()
Shadow DOM
+- Full style encapsulation
Recommendation: Use light DOM when it's necessary to style the component based on slotted elements or for compatibility reasons with third party libraries, use Shadow DOM otherwise.
Slots or internal content?
Slots
Internal content
Recommendation: Use slots. Abstract away logic, but not content or semantic structure.
Beta Was this translation helpful? Give feedback.
All reactions