diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 9130a0fe3..826d6885c 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -6,22 +6,51 @@ You can use Shoelace via CDN or by installing it locally. The easiest way to install Shoelace is with the CDN. Just add the following tags to your page. +```html + + + +``` + +The `media` attributes ensure that only the user's preferred theme stylesheet loads, and the `onload` attribute sets the appropriate [theme class](/getting-started/themes/) on the `` element. + +### Forcing Light or Dark Themes + +To force Shoelace to use the light theme, load the light stylesheet only. Since light theme is the default, you don't need to take any further steps. + ```html ``` +To force the dark theme, set the `sl-theme-dark` class on the `` element and load the dark stylesheet. + +```html + + + + + + + + + + +``` + Now you can [start using Shoelace!](/getting-started/usage) ## Local Installation -If you don't want to use the CDN, you can install Shoelace locally with the following command. +If you don't want to use the CDN, you can install Shoelace locally with the following command. ```bash npm install @shoelace-style/shoelace ``` -It's up to you to make the source files available to your app. One way to do this is to create a route in your app called `/scripts/shoelace` that serves static files from `node_modules/@shoelace-style/shoelace`. +It's up to you to make the source files available to your app. One way to do this is to create a route in your app called `/scripts/shoelace` that serves static files from `node_modules/@shoelace-style/shoelace`. Once you've done that, add the following tags to your page. Make sure to update `href` and `src` so they point to the route you created. @@ -66,7 +95,7 @@ Here's an example that loads only the button component. Again, if you're not usi ``` @@ -108,4 +137,4 @@ setBasePath('/dist/shoelace'); // , , , and are ready to use! ``` -!> Component modules include side effects for registration purposes. Because of this, importing directly from `@shoelace-style/shoelace` may result in a larger bundle size than necessary. For optimal tree shaking, always cherry pick, i.e. import components and utilities from their respective files, as shown above. \ No newline at end of file +!> Component modules include side effects for registration purposes. Because of this, importing directly from `@shoelace-style/shoelace` may result in a larger bundle size than necessary. For optimal tree shaking, always cherry pick, i.e. import components and utilities from their respective files, as shown above.