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
Copy file name to clipboardExpand all lines: docs/01-app/01-getting-started/05-css.mdx
+3-92Lines changed: 3 additions & 92 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ related:
6
6
title: Next Steps
7
7
description: Learn more about the features mentioned in this page.
8
8
links:
9
+
- app/guides/tailwind-css
9
10
- app/guides/sass
10
11
- app/guides/css-in-js
11
12
---
@@ -14,10 +15,10 @@ Next.js provides several ways to use CSS in your application, including:
14
15
15
16
-[CSS Modules](#css-modules)
16
17
-[Global CSS](#global-css)
17
-
-[Tailwind CSS](#tailwind-css)
18
+
-[External Stylesheets](#external-stylesheets)
19
+
-[Tailwind CSS](/docs/app/guides/tailwind-css)
18
20
-[Sass](/docs/app/guides/sass)
19
21
-[CSS-in-JS](/docs/app/guides/css-in-js)
20
-
-[External Stylesheets](#external-stylesheets)
21
22
22
23
## CSS Modules
23
24
@@ -93,96 +94,6 @@ export default function RootLayout({ children }) {
93
94
94
95
> **Good to know:** Global styles can be imported into any layout, page, or component inside the `app` directory. However, since Next.js uses React's built-in support for stylesheets to integrate with Suspense, this currently does not remove stylesheets as you navigate between routes which can lead to conflicts. We recommend using global styles for _truly_ global CSS, and [CSS Modules](#css-modules) for scoped CSS.
95
96
96
-
## Tailwind CSS
97
-
98
-
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework that integrates seamlessly with Next.js.
99
-
100
-
### Installing Tailwind
101
-
102
-
To start using Tailwind, install the necessary Tailwind CSS packages:
Copy file name to clipboardExpand all lines: docs/01-app/02-guides/css-in-js.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ The following are currently working on support:
32
32
33
33
> **Good to know**: We're testing out different CSS-in-JS libraries and we'll be adding more examples for libraries that support React 18 features and/or the `app` directory.
34
34
35
-
If you want to style Server Components, we recommend using [CSS Modules](/docs/app/building-your-application/styling/css) or other solutions that output CSS files, like PostCSS or [Tailwind CSS](/docs/app/building-your-application/styling/tailwind-css).
35
+
If you want to style Server Components, we recommend using [CSS Modules](/docs/app/building-your-application/styling/css) or other solutions that output CSS files, like PostCSS or [Tailwind CSS](/docs/app/guides/tailwind-css).
Copy file name to clipboardExpand all lines: docs/01-app/02-guides/migrating/app-router-migration.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -887,7 +887,7 @@ If you are also migrating to Next.js from a Single-Page Application (SPA) at the
887
887
In the `pages` directory, global stylesheets are restricted to only `pages/_app.js`. With the `app` directory, this restriction has been lifted. Global styles can be added to any layout, page, or component.
Copy file name to clipboardExpand all lines: docs/01-app/02-guides/tailwind-css.mdx
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
---
2
-
title: Tailwind CSS
2
+
title: How to install Tailwind CSS in your Next.js application
3
+
nav_title: Tailwind CSS
3
4
description: Style your Next.js Application using Tailwind CSS.
4
5
---
5
6
6
7
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
7
8
8
-
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework that is fully compatible with Next.js.
9
+
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework that is fully compatible with Next.js. This guide will walk you through how to install Tailwind CSS in your Next.js application.
9
10
10
11
## Installing Tailwind
11
12
@@ -15,6 +16,8 @@ Install the necessary Tailwind CSS packages:
> **Good to know**: If you're using the `create-next-app` CLI to create your project, Next.js will prompt if you'd like to install Tailwind and automatically configure the project.
20
+
18
21
## Configuring Tailwind
19
22
20
23
Create a `postcss.config.mjs` file in the root of your project and add the `@tailwindcss/postcss` plugin to your PostCSS configuration:
Copy file name to clipboardExpand all lines: docs/01-app/03-building-your-application/05-styling/01-css.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -348,7 +348,7 @@ To maintain a predictable order, we recommend the following:
348
348
- Prefer CSS Modules over global styles.
349
349
- Use a consistent naming convention for your CSS modules. For example, using `<name>.module.css` over `<name>.tsx`.
350
350
- Extract shared styles into a separate shared component.
351
-
- If using [Tailwind](/docs/app/building-your-application/styling/tailwind-css), import the stylesheet at the top of the file, preferably in the [Root Layout](/docs/app/building-your-application/routing/layouts-and-templates#root-layout-required).
351
+
- If using [Tailwind](/docs/app/guides/tailwind-css), import the stylesheet at the top of the file, preferably in the [Root Layout](/docs/app/building-your-application/routing/layouts-and-templates#root-layout-required).
352
352
- Turn off any linters/formatters (e.g., ESLint's [`sort-import`](https://eslint.org/docs/latest/rules/sort-imports)) that automatically sort your imports. This can inadvertently affect your CSS since CSS import order _matters_.
description: Learn about the different ways to add CSS to your application, including CSS Modules, Global CSS, Tailwind CSS, and more.
5
+
related:
6
+
title: Next Steps
7
+
description: Learn more about the features mentioned in this page.
8
+
links:
9
+
- pages/guides/tailwind-css
10
+
- pages/guides/sass
11
+
- pages/guides/css-in-js
12
+
source: app/getting-started/css
13
+
---
14
+
15
+
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
0 commit comments