You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/pages/docs/guides/components/index2.mdx
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,9 @@ Components work natively in React, Vue, Angular, or any framework that supports
35
35
36
36
Components defined with [`defineComponent`](/docs/guides/components/create) can register a `tagName` for direct HTML use, or export without one for use as [subtemplates](/docs/guides/templates/subtemplates) within other components.
37
37
38
-
## Defining Components
38
+
## Key Features
39
+
40
+
### Defining Components
39
41
40
42
[`defineComponent`](/docs/guides/components/create) registers a standard custom element. All features (templating, state, events, styling) are configured in a single definition object:
41
43
@@ -53,7 +55,7 @@ defineComponent({
53
55
});
54
56
```
55
57
56
-
##Templates, Not Strings
58
+
### Templating
57
59
58
60
Vanilla Web Components typically require string concatenation or verbose `document.createElement` calls to render dynamic content. The [templating system](/docs/guides/templates) replaces this with declarative syntax: [expressions](/docs/guides/templates/expressions), [conditionals](/docs/guides/templates/conditionals), [loops](/docs/guides/templates/loops), and [slots](/docs/guides/templates/slots). Templates compile to an AST for efficient updates.
59
61
@@ -70,7 +72,7 @@ Vanilla Web Components typically require string concatenation or verbose `docume
70
72
{/each}
71
73
```
72
74
73
-
## Styling That Scopes
75
+
###Styling
74
76
75
77
Global CSS in component-based applications leads to specificity wars, naming conventions (BEM, CSS Modules), or build-time extraction. Shadow DOM provides true encapsulation, but working with it requires understanding CSS variable inheritance and `:host` selectors. The [styling system](/docs/guides/components/styling) handles this integration:
76
78
@@ -88,7 +90,7 @@ Global CSS in component-based applications leads to specificity wars, naming con
88
90
}
89
91
```
90
92
91
-
## Events, No Boilerplate
93
+
###Events
92
94
93
95
The standard `addEventListener` / `removeEventListener` pattern requires manual cleanup, doesn't support delegation naturally, and scatters event logic across lifecycle methods. [Declarative events](/docs/guides/components/events) bind handlers to selectors, support delegation, and clean up automatically:
Implementing keyboard shortcuts typically means parsing `event.key`, tracking modifier state, and managing focus. [Declarative key bindings](/docs/guides/components/keys) handle combinations and sequences with automatic scope management:
0 commit comments