How can we use a Patternfly element inside of a custom Lit element? #2071
-
I can't seem to get any Patternfly Elements working within my own custom Lit element. As per the instructions, I've installed, for example, npm install @patternfly/pfe-card I imported in my custom Lit element as follows: import '@patternfly/pfe-card' Then I just render using the tag like so... override render() {
return html`
<pfe-card>
<h2 slot="header">Card header</h2>
<p>This is the pfe-card body.</p>
<p slot="footer">This is the footer</p>
</pfe-card>
`;
} This is what it renders (missing the header and footer slots): I have a similar issues rendering a modal. It renders the HTML that it recognizes, but I don't think the component is actually there. It's just rendering what's in the html tags... override render() {
return html`
<hr/>
<pfe-modal trigger="usage-trigger">
<h2 slot="header">Modal with a header</h2>
<p>Lorem ipsum dolor sit amet, <a href="#foo">consectetur adipisicing</a> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<pfe-cta>
<a href="#bar">Learn more</a>
</pfe-cta>
</pfe-modal>
<button id="usage-trigger">Open modal</button>
<hr/>
`;
} I don't know what I'm doing wrong. I'm just going by what's documented. Anybody got any tips? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Can you show me your package.json? Also do try npm i @patternfly/pfe-card@next Do you get any typescript errors? Any browser console errors or output? When you inspect the pfe-card element, does it have a shadowroot? |
Beta Was this translation helpful? Give feedback.
Can you show me your package.json?
Also do try
Do you get any typescript errors? Any browser console errors or output? When you inspect the pfe-card element, does it have a shadowroot?