# Installation To get started, install the SMUI packages you need. ```sh npm install --save-dev @smui/button npm install --save-dev @smui/card # etc... ``` You can also [use SMUI in the Svelte REPL](/REPL.md). ## SvelteKit For SvelteKit, check out the [SvelteKit instructions](/SVELTEKIT.md). Otherwise, read on. ## Importing Components **Please note that these imports require a theme. See the default or custom theme below.** You will always import Svelte components from the individual packages. ```svelte ``` ## Fonts Material uses the Roboto fonts, so be sure to include these stylesheets (or include them from a package). ```html ``` ## Icons The easiest way to get Material icons is the font. If you'd like to use the Material Icons font, include that, also in the `head` section. ```html ``` However, you can get a greatly expanded icon library and reduce over-the-wire sizes by using [the MDI library](https://pictogrammers.com/library/mdi/) instead. ```sh npm install --save-dev @mdi/js ``` You can see how to use these icons on the "Using SVGs" demo on the [Icon Button demo page](https://sveltematerialui.com/demo/icon-button/). ## Installing a Theme ### A Custom Theme Check out the [theming instructions](/THEMING.md) for setting up a custom theme. ### The Default Theme You can use the prebuilt "bare.css" file from the "svelte-material-ui" package. If you use this option you _can_ mostly customize your theme, but your [theming options](/THEMING.md#theming-the-bare-css) are more limited. ```sh npm install --save svelte-material-ui ``` ```html ``` If that's not working (probably because your dependencies aren't copied to your build folder), you can also use a CDN. Just be sure you update the version here when you update to a new version of SMUI. **This is already an outdated version, so update it now too.** ```html ``` You can also use the "bare.css" files from the individual packages if you don't use many components and want smaller file sizes. ### A Premade Theme There are some premade themes as well in the "svelte-material-ui" package, including dark mode versions. These are the same themes that appear on the [demo site](https://sveltematerialui.com/). You won't find the CSS in the repo, because they're not git tracked, but here's a list. - `themes/svelte.css` - `themes/svelte-dark.css` - `themes/material.css` - `themes/material-dark.css` - `themes/fixation.css` - `themes/fixation-dark.css` - `themes/bubblegum.css` - `themes/bubblegum-dark.css` - `themes/metro.css` - `themes/metro-dark.css` - `themes/unity.css` - `themes/unity-dark.css` ```sh npm install --save svelte-material-ui ``` ```html ``` Or with a CDN. **Remember to update the version!** ```html ``` ## Making Your Tooling Svelte-Aware A lot of tooling is already Svelte-aware, but if you are installing into a Rollup or Webpack project, you will need to configure its export conditions names to see Svelte libraries correctly. ### Rollup You will need to add `'svelte'` to the [`exportConditions` config](https://github.com/rollup/plugins/tree/master/packages/node-resolve#exportconditions) of `nodeResolve`. ```js // ... import { nodeResolve } from '@rollup/plugin-node-resolve'; export default { // ... plugins: [ // ... nodeResolve({ // ... exportConditions: ['svelte'], }), ], }; ``` ### Webpack You will need to add `'svelte'` to the [`resolve.conditionNames` config](https://webpack.js.org/configuration/resolve/#resolveconditionnames). ```js module.exports = { // ... resolve: { // ... conditionNames: ['svelte', 'require', 'node'], }, }; ```