File tree Expand file tree Collapse file tree 6 files changed +56
-18
lines changed
docs/documentation-generation
versioned_docs/version-v4.42/documentation-generation Expand file tree Collapse file tree 6 files changed +56
-18
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ slug: /doc-generation
99
1010- [ ` docs-readme ` : Documentation readme files formatted in markdown] ( ./docs-readme.md )
1111- [ ` docs-json ` : Documentation data formatted in JSON] ( ./docs-json.md )
12+ - [ ` docs-custom-elements-manifest ` : Custom Elements Manifest (CEM) format] ( ./docs-custom-elements-manifest.md )
1213- [ ` docs-custom ` : Custom documentation generation] ( ./docs-custom.md )
1314- [ ` docs-vscode ` : Documentation generation for VS Code] ( ./docs-vscode.md )
1415- [ ` stats ` : Stats about the compiled files] ( ./docs-stats.md )
Original file line number Diff line number Diff line change @@ -75,12 +75,13 @@ Then you'd get the following in the JSON output:
7575]
7676```
7777
78- ## Slots
78+ ## Slots and CSS Parts
7979
8080If one of your Stencil components makes use of
8181[ slots] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot ) for
82- rendering children you can document them by using the ` @slot ` JSDoc tag in the
83- component's comment.
82+ rendering children or [ CSS Parts] ( https://developer.mozilla.org/en-US/docs/Web/CSS/::part ) for styling,
83+ you can document them by using the ` @slot ` and ` @part ` JSDoc tags in the
84+ component's comments.
8485
8586For instance, if you had a ` my-button ` component with a slot you might document
8687it like so:
@@ -90,6 +91,8 @@ import { Component, h } from '@stencil/core';
9091
9192/**
9293 * @slot buttonContent - Slot for the content of the button
94+ *
95+ * @part button - The button element
9396 */
9497@Component ({
9598 tag: ' my-button' ,
@@ -98,7 +101,7 @@ import { Component, h } from '@stencil/core';
98101})
99102export class MyButton {
100103 render() {
101- return <button ><slot name = " buttonContent" ></slot ></button >
104+ return <button part = " button " ><slot name = " buttonContent" ></slot ></button >
102105 }
103106}
104107```
@@ -111,6 +114,12 @@ This would show up in the generated JSON file like so:
111114 "name" : " buttonContent" ,
112115 "description" : " Slot for the content of the button"
113116 }
117+ ],
118+ "cssParts" : [
119+ {
120+ "name" : " button" ,
121+ "description" : " The button element"
122+ }
114123]
115124```
116125
Original file line number Diff line number Diff line change @@ -153,12 +153,13 @@ latter you'll need to have the
153153and configured.
154154:::
155155
156- ## Slots
156+ ## Slots and CSS Parts
157157
158158If one of your Stencil components makes use of
159159[ slots] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot ) for
160- rendering children you can document them by using the ` @slot ` JSDoc tag in the
161- component's comment.
160+ rendering children or [ CSS Parts] ( https://developer.mozilla.org/en-US/docs/Web/CSS/::part ) for styling,
161+ you can document them by using the ` @slot ` and ` @part ` JSDoc tags in the
162+ component's comments.
162163
163164For instance, if you had a ` my-button ` component with a slot you might document
164165it like so:
@@ -168,6 +169,8 @@ import { Component, h } from '@stencil/core';
168169
169170/**
170171 * @slot buttonContent - Slot for the content of the button
172+ *
173+ * @part button - The button element
171174 */
172175@Component ({
173176 tag: ' my-button' ,
@@ -176,7 +179,7 @@ import { Component, h } from '@stencil/core';
176179})
177180export class MyButton {
178181 render() {
179- return <button ><slot name = " buttonContent" ></slot ></button >
182+ return <button part = " button " ><slot name = " buttonContent" ></slot ></button >
180183 }
181184}
182185```
@@ -187,7 +190,13 @@ This would show up in the generated JSON file like so:
187190"slots" : [
188191 {
189192 "name" : " buttonContent" ,
190- "description" : " Slot for the content of the button"
193+ "docs" : " Slot for the content of the button"
194+ }
195+ ],
196+ "parts" : [
197+ {
198+ "name" : " button" ,
199+ "docs" : " The button element"
191200 }
192201]
193202```
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ slug: /doc-generation
99
1010- [ ` docs-readme ` : Documentation readme files formatted in markdown] ( ./docs-readme.md )
1111- [ ` docs-json ` : Documentation data formatted in JSON] ( ./docs-json.md )
12+ - [ ` docs-custom-elements-manifest ` : Custom Elements Manifest (CEM) format] ( ./docs-custom-elements-manifest.md )
1213- [ ` docs-custom ` : Custom documentation generation] ( ./docs-custom.md )
1314- [ ` docs-vscode ` : Documentation generation for VS Code] ( ./docs-vscode.md )
1415- [ ` stats ` : Stats about the compiled files] ( ./docs-stats.md )
Original file line number Diff line number Diff line change @@ -75,12 +75,13 @@ Then you'd get the following in the JSON output:
7575]
7676```
7777
78- ## Slots
78+ ## Slots and CSS Parts
7979
8080If one of your Stencil components makes use of
8181[ slots] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot ) for
82- rendering children you can document them by using the ` @slot ` JSDoc tag in the
83- component's comment.
82+ rendering children or [ CSS Parts] ( https://developer.mozilla.org/en-US/docs/Web/CSS/::part ) for styling,
83+ you can document them by using the ` @slot ` and ` @part ` JSDoc tags in the
84+ component's comments.
8485
8586For instance, if you had a ` my-button ` component with a slot you might document
8687it like so:
@@ -90,6 +91,8 @@ import { Component, h } from '@stencil/core';
9091
9192/**
9293 * @slot buttonContent - Slot for the content of the button
94+ *
95+ * @part button - The button element
9396 */
9497@Component ({
9598 tag: ' my-button' ,
@@ -98,7 +101,7 @@ import { Component, h } from '@stencil/core';
98101})
99102export class MyButton {
100103 render() {
101- return <button ><slot name = " buttonContent" ></slot ></button >
104+ return <button part = " button " ><slot name = " buttonContent" ></slot ></button >
102105 }
103106}
104107```
@@ -111,6 +114,12 @@ This would show up in the generated JSON file like so:
111114 "name" : " buttonContent" ,
112115 "description" : " Slot for the content of the button"
113116 }
117+ ],
118+ "cssParts" : [
119+ {
120+ "name" : " button" ,
121+ "description" : " The button element"
122+ }
114123]
115124```
116125
Original file line number Diff line number Diff line change @@ -153,12 +153,13 @@ latter you'll need to have the
153153and configured.
154154:::
155155
156- ## Slots
156+ ## Slots and CSS Parts
157157
158158If one of your Stencil components makes use of
159159[ slots] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot ) for
160- rendering children you can document them by using the ` @slot ` JSDoc tag in the
161- component's comment.
160+ rendering children or [ CSS Parts] ( https://developer.mozilla.org/en-US/docs/Web/CSS/::part ) for styling,
161+ you can document them by using the ` @slot ` and ` @part ` JSDoc tags in the
162+ component's comments.
162163
163164For instance, if you had a ` my-button ` component with a slot you might document
164165it like so:
@@ -168,6 +169,8 @@ import { Component, h } from '@stencil/core';
168169
169170/**
170171 * @slot buttonContent - Slot for the content of the button
172+ *
173+ * @part button - The button element
171174 */
172175@Component ({
173176 tag: ' my-button' ,
@@ -176,7 +179,7 @@ import { Component, h } from '@stencil/core';
176179})
177180export class MyButton {
178181 render() {
179- return <button ><slot name = " buttonContent" ></slot ></button >
182+ return <button part = " button " ><slot name = " buttonContent" ></slot ></button >
180183 }
181184}
182185```
@@ -187,7 +190,13 @@ This would show up in the generated JSON file like so:
187190"slots" : [
188191 {
189192 "name" : " buttonContent" ,
190- "description" : " Slot for the content of the button"
193+ "docs" : " Slot for the content of the button"
194+ }
195+ ],
196+ "parts" : [
197+ {
198+ "name" : " button" ,
199+ "docs" : " The button element"
191200 }
192201]
193202```
You can’t perform that action at this time.
0 commit comments