Skip to content

Commit 87602bb

Browse files
committed
provide more details in template component name description
1 parent 22ddeca commit 87602bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/v2/style-guide/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,13 @@ Unfortunately, HTML doesn't allow custom elements to be self-closing - only [off
849849

850850
**Component names should always be PascalCase in [single-file components](single-file-components.html) and string templates - but kebab-case in DOM templates.**
851851

852-
PascalCase in templates improves readability, because it's easier to tell at a glance what's an element and what's a component. Unfortunately, PascalCase is invalid for a custom element in HTML, so a DOM template must still use kebab-case.
852+
PascalCase has a few advantages over kebab-case:
853+
854+
- Editors can autocomplete component names in templates, because PascalCase is also used in JavaScript.
855+
- `<MyComponent>` is more visually distinct from a single-word HTML element than `<my-component>`, because there are two character differences (the two capitals), rather than just one (a hyphen).
856+
- If you use any non-Vue custom elements in your templates, such as a web component, PascalCase ensures that your Vue components remain distinctly visible.
857+
858+
Unfortunately, due to HTML's case insensitivity, DOM templates must still use kebab-case.
853859

854860
{% raw %}<div class="style-example example-bad">{% endraw %}
855861
#### Bad

0 commit comments

Comments
 (0)