You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Tailwind theme config defines Starlight's [cascade layers](#cascade-layers) order, imports Starlight’s Tailwind complementary CSS, and imports Tailwind’s theme and utility styles.
186
+
If your project requires additional Tailwind configuration, check out the [“Use multiple Tailwind configurations”](#use-multiple-tailwind-configurations) section.
187
+
185
188
4. Update the Starlight config to add the Tailwind CSS file as the first item in the `customCss` array:
186
189
187
190
```js ins={11-12}
@@ -208,7 +211,7 @@ If you already have a Starlight site and want to add Tailwind CSS, follow these
208
211
209
212
### Styling Starlight with Tailwind
210
213
211
-
Starlight will use values from your [Tailwind theme config](https://tailwindcss.com/docs/theme)in its UI.
214
+
When [creating a new Starlight project with Tailwind](#create-a-new-project-with-tailwind), or when [adding Tailwind to an existing Starlight project](#add-tailwind-to-an-existing-project), Starlight will use values from your [Tailwind theme config](https://tailwindcss.com/docs/theme)located in the `src/styles/global.css` file to style its UI.
212
215
213
216
If set, the following CSS custom properties will override Starlight’s default styles:
214
217
@@ -257,6 +260,34 @@ If set, the following CSS custom properties will override Starlight’s default
257
260
}
258
261
```
259
262
263
+
### Use multiple Tailwind configurations
264
+
265
+
Multiple Tailwind configurations can be used to apply different styles to different parts of your site, e.g. when [using Starlight at a subpath](/manual-setup/#use-starlight-at-a-subpath) or when adding [custom pages](/guides/pages/#custom-pages) to your site.
266
+
For example, you may want to use Tailwind’s Preflight reset styles in your custom pages, while still applying Starlight’s compatibility layer to Starlight pages.
267
+
268
+
The following Tailwind CSS configuration sets up Tailwind without any plugins or extra configuration and can be used as a starting point for non-Starlight pages:
/* Load Tailwind without any of Starlight's complementary CSS. */
272
+
@import'tailwindcss';
273
+
```
274
+
275
+
<Steps>
276
+
277
+
1. For Starlight pages, apply your preferred Tailwind CSS configuration by following [“Add Tailwind to an existing project”](#add-tailwind-to-an-existing-project).
278
+
279
+
2. For other pages, apply your preferred Tailwind CSS configuration by importing it in those pages. This is often done in a layout component so that Tailwind styles can be used on all pages sharing that layout.
280
+
```astro
281
+
---
282
+
// src/layouts/CustomPageLayout.astro
283
+
import '../styles/custom-pages-tailwind.css';
284
+
---
285
+
```
286
+
287
+
</Steps>
288
+
289
+
To learn more about Tailwind theme configurations, check out the [Tailwind CSS documentation](https://tailwindcss.com/docs/theme).
290
+
260
291
## Theming
261
292
262
293
Starlight’s color theme can be controlled by overriding its default custom properties.
0 commit comments