material-components-web-components | Material Design Web Components | User Interface library
kandi X-RAY | material-components-web-components Summary
kandi X-RAY | material-components-web-components Summary
Material Design Web Components
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of material-components-web-components
material-components-web-components Key Features
material-components-web-components Examples and Code Snippets
Community Discussions
Trending Discussions on material-components-web-components
QUESTION
I followed the standard tutorial in sveltkit to create a Typescript Project for a basic template.
I wanted to use Material Web Component Button.
I npm install @material/mwc-button
.
Then I simply add the following to routes/index.svelte
ANSWER
Answered 2021-Jun-20 at 02:16Wow, that error message is very unhelpful. In a non-TS SvelteKit project, you get Error when evaluating SSR module /node_modules/lit-html/lib/template-result.js: ReferenceError: window is not defined
, which is a little clearer about what is going on.
Importing Material Web Components runs code that uses window
, which is not available on the server. Because of this, Vite throws an error while trying to process the imported mwc-button
library. You can use a dynamic import in Svelte's onMount lifecycle function so that the library is only imported on the client. You will have to do this with any web component you import.
QUESTION
Based on the code snippet below (and found here), the material library is styling the component based on the text content of mwc-icon. After looking at the source code for mwc-icon found here, there doesn't seem to be any javascript logic doing the styling directly. Somehow this seems to be happening in the css or in the font definition itself.
How is the icon being applied/rendered in place of the text?
...ANSWER
Answered 2020-Mar-07 at 04:56The answer for your question is that the font-family property set in the file. You have imported the Material Icons font and used it. There is where the icon name you enter is defined. Instead of character definitions icon names are defined and mapped to the corresponding svg or png images.refer here
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install material-components-web-components
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page