diff --git a/code/renderers/web-components/src/docs/__testfixtures__/lit-element-demo-card/properties.snapshot b/code/renderers/web-components/src/docs/__testfixtures__/lit-element-demo-card/properties.snapshot
index 127bc8704a4a..7f1b194d16b6 100644
--- a/code/renderers/web-components/src/docs/__testfixtures__/lit-element-demo-card/properties.snapshot
+++ b/code/renderers/web-components/src/docs/__testfixtures__/lit-element-demo-card/properties.snapshot
@@ -84,7 +84,7 @@ Object {
},
},
"type": Object {
- "name": "void",
+ "name": "boolean",
},
},
"backSide": Object {
@@ -126,7 +126,7 @@ Object {
"name": "header",
"required": false,
"table": Object {
- "category": "properties",
+ "category": "attributes",
"defaultValue": Object {
"summary": "\\"Your Message\\"",
},
@@ -152,7 +152,7 @@ Object {
"name": "rows",
"required": false,
"table": Object {
- "category": "properties",
+ "category": "attributes",
"defaultValue": Object {
"summary": "[]",
},
diff --git a/code/renderers/web-components/src/docs/custom-elements.ts b/code/renderers/web-components/src/docs/custom-elements.ts
index 66743bfdd7a8..c60d23bfe1ea 100644
--- a/code/renderers/web-components/src/docs/custom-elements.ts
+++ b/code/renderers/web-components/src/docs/custom-elements.ts
@@ -39,8 +39,19 @@ interface Declaration {
}
function mapItem(item: TagItem, category: string): InputType {
- const type =
- category === 'properties' ? { name: item.type?.text || item.type } : { name: 'void' };
+ let type;
+ switch (category) {
+ case 'attributes':
+ case 'properties':
+ type = { name: item.type?.text || item.type };
+ break;
+ case 'slots':
+ type = { name: 'string' };
+ break;
+ default:
+ type = { name: 'void' };
+ break;
+ }
return {
name: item.name,
@@ -137,13 +148,13 @@ export const extractArgTypesFromElements = (tagName: string, customElements: Cus
const metaData = getMetaData(tagName, customElements);
return (
metaData && {
- ...mapData(metaData.attributes, 'attributes'),
- ...mapData(metaData.members, 'properties'),
- ...mapData(metaData.properties, 'properties'),
- ...mapData(metaData.events, 'events'),
- ...mapData(metaData.slots, 'slots'),
- ...mapData(metaData.cssProperties, 'css custom properties'),
- ...mapData(metaData.cssParts, 'css shadow parts'),
+ ...mapData(metaData.members ?? [], 'properties'),
+ ...mapData(metaData.properties ?? [], 'properties'),
+ ...mapData(metaData.attributes ?? [], 'attributes'),
+ ...mapData(metaData.events ?? [], 'events'),
+ ...mapData(metaData.slots ?? [], 'slots'),
+ ...mapData(metaData.cssProperties ?? [], 'css custom properties'),
+ ...mapData(metaData.cssParts ?? [], 'css shadow parts'),
}
);
};
diff --git a/code/renderers/web-components/template/stories/custom-elements.json b/code/renderers/web-components/template/stories/custom-elements.json
index 7389e1bab99b..6bdc06ce7a23 100644
--- a/code/renderers/web-components/template/stories/custom-elements.json
+++ b/code/renderers/web-components/template/stories/custom-elements.json
@@ -51,8 +51,8 @@
],
"slots": [
{
- "description": "This is an unnamed slot (the default slot)",
- "name": ""
+ "name": "prefix",
+ "description": "Label prefix"
}
],
"members": [
diff --git a/code/renderers/web-components/template/stories/demo-wc-card.stories.js b/code/renderers/web-components/template/stories/demo-wc-card.stories.js
index 0e5dd11f3e68..193a961c6bce 100644
--- a/code/renderers/web-components/template/stories/demo-wc-card.stories.js
+++ b/code/renderers/web-components/template/stories/demo-wc-card.stories.js
@@ -3,14 +3,22 @@ import './demo-wc-card';
export default {
component: 'demo-wc-card',
+ render: ({ backSide, header, rows, prefix }) =>
+ html`
+