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/docs/api/templates.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
# API >> Templates || 30
2
2
3
-
API Viewer uses the [`<template>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) element to configure the live demo.
4
-
Templates can be used to customize the default values for properties, to setup custom knobs, and to provide wrapper, prefix, or suffix elements.
3
+
API Viewer uses the [`<template>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) element for configuring the live demo.
4
+
With templates, you can customize the default properties values, set up custom [knobs](../../guide/using-demo/#knobs), or provide additional HTML to be shown in the demo.
5
5
6
6
## Setting templates
7
7
8
-
Both `<api-viewer>` and `<api-demo>` elements collect template passing to them declaratively at the time of initialization.
9
-
Alternatively, you can call `setTemplates()` method to provide `<template>` elements lazily.
8
+
Both `<api-viewer>` and `<api-demo>` elements collect `<template>` elements passed to them declaratively at the time of initialization.
9
+
Alternatively, you can call `setTemplates()` method to provide a set of templates lazily.
Copy file name to clipboardExpand all lines: docs/docs/guide/using-demo.md
+7-5
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Several panels are available depending on the functionality the component suppor
5
5
6
6
## Importing
7
7
8
-
In order to enable live demos, import the components documented in the manifest.
8
+
In order to use live demo, import the components documented in the manifest.
9
9
The demo component uses [`customElements.whenDefined()`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined), which returns a Promise, so importing the components lazily also works.
10
10
11
11
```html
@@ -15,12 +15,13 @@ The demo component uses [`customElements.whenDefined()`](https://developer.mozil
If you want to render live demo separately from the API documentation, consider using `<api-demo>` element instead of the `<api-viewer>`.
18
+
If you want to render live demo separately from the API documentation, consider using [`<api-demo>`](../../examples/api-demo/) element instead of the `<api-viewer>`.
19
19
All of the features and use cases listed below apply to both components.
20
20
21
21
## Source
22
22
23
-
The Source panel contains an HTML code snippet representing the component with its properties, HTML attributes and slots.
23
+
The Source panel contains an HTML code snippet representing the component with its
24
+
[properties](../writing-jsdoc/#properties), HTML attributes and [slots](../writing-jsdoc/#slots).
24
25
When setting knobs or styles using corresponding panels, code snippet is updated.
25
26
26
27
For example, changing a custom CSS property to the value other than the default one will add `<style>` tag to the snippet.
@@ -34,7 +35,8 @@ Play with the component to tweak its appearance, set `textContent` for its `<slo
34
35
Knobs panel is of the live demo inspired by corresponding Storybook addon.
35
36
It allows to toggle properties, attributes and set slots content on the element instance, and updates the code snippet accordingly.
36
37
37
-
The playground listens to the events dispatched by the component and uses `[property]-changed` events to sync knobs controls with the component's state.
38
+
The playground listens to the [events](../writing-jsdoc/#events) dispatched by the component
39
+
and uses `[property]-changed` events to sync knobs controls with the component's state.
38
40
This is useful if the component handles user input:
39
41
40
42
```js
@@ -50,7 +52,7 @@ This is useful if the component handles user input:
50
52
51
53
## Styles
52
54
53
-
The live demo relies on the analyzer to get default values for documented custom CSS properties.
55
+
The live demo relies on the analyzer to get default values for documented [CSS Custom Properties](../writing-jsdoc/#css-custom-properties).
54
56
As a fallback, it collects the values on the rendered component using `getComputedStyle(element).getPropertyValue()`.
55
57
56
58
We recommend using the following CSS structure to provide styling API for web components to make Styles panel work.
0 commit comments