Unverified Commit 5127c33f authored by Tyler Lutz's avatar Tyler Lutz Committed by GitHub

Add page router documentation (#51626)

Adds tailwindcss documentation for the pages router.
parent e3ad371c
...@@ -49,6 +49,8 @@ module.exports = { ...@@ -49,6 +49,8 @@ module.exports = {
You do not need to modify `postcss.config.js`. You do not need to modify `postcss.config.js`.
<AppOnly>
## Importing Styles ## Importing Styles
Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/app/building-your-application/styling/css-modules#global-styles) in your application, for example: Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/app/building-your-application/styling/css-modules#global-styles) in your application, for example:
...@@ -119,6 +121,59 @@ export default function Page() { ...@@ -119,6 +121,59 @@ export default function Page() {
} }
``` ```
</AppOnly>
<PagesOnly>
## Importing Styles
Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/pages/building-your-application/styling/css-modules#global-styles) in your application, for example:
```css filename="styles/globals.css"
@tailwind base;
@tailwind components;
@tailwind utilities;
```
Inside the [custom app file](/docs/pages/building-your-application/routing/custom-app) (`pages/_app.js`), import the `globals.css` stylesheet to apply the styles to every route in your application.
```tsx filename="pages/_app.tsx" switcher
// These styles apply to every route in the application
import '@/styles/globals.css'
import type { AppProps } from 'next/app'
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
```
```jsx filename="pages/_app.js" switcher
// These styles apply to every route in the application
import '@/styles/globals.css'
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />
}
```
## Using Classes
After installing Tailwind CSS and adding the global styles, you can use Tailwind's utility classes in your application.
```tsx filename="pages/index.tsx" switcher
export default function Page() {
return <h1 className="text-3xl font-bold underline">Hello, Next.js!</h1>
}
```
```jsx filename="pages/index.js" switcher
export default function Page() {
return <h1 className="text-3xl font-bold underline">Hello, Next.js!</h1>
}
```
</PagesOnly>
## Usage with Turbopack ## Usage with Turbopack
As of Next.js 13.1, Tailwind CSS and PostCSS are supported with [Turbopack](https://turbo.build/pack/docs/features/css#tailwind-css). As of Next.js 13.1, Tailwind CSS and PostCSS are supported with [Turbopack](https://turbo.build/pack/docs/features/css#tailwind-css).
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment