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
Read the Tailwind CSS documentation on [ordering stacked modifiers](https://tailwindcss.com/docs/hover-focus-and-other-states#ordering-stacked-modifiers) to learn more.
187
+
Read the Tailwind CSS documentation on [stacked modifiers](https://tailwindcss.com/docs/hover-focus-and-other-states) to learn more.
196
188
197
189
### Overriding max-width
198
190
@@ -237,7 +229,15 @@ Note that you can't nest new `prose` instances within a `not-prose` block at thi
237
229
238
230
### Adding custom color themes
239
231
240
-
You can create your own color theme by adding a new key in the `typography` section of your `tailwind.config.js` file and providing your colors under the `css` key:
232
+
To customize the color theme beyond simple CSS overrides, you can use the JavaScript based theme API. To do that, use the `@config` directive:
233
+
234
+
```diff
235
+
@import "tailwindcss";
236
+
@plugin "@tailwindcss/typography";
237
+
+ @config "./tailwind.config.js";
238
+
```
239
+
240
+
You can then create your own color theme by adding a new `tailwind.config.js` file with the `typography` section and providing your colors under the `css` key:
@@ -297,18 +293,10 @@ See our internal [style definitions](https://github.com/tailwindlabs/tailwindcss
297
293
298
294
If you need to use a class name other than `prose` for any reason, you can do so using the `className` option when registering the plugin:
299
295
300
-
```js {{ filename: 'tailwind.config.js' }}
301
-
/**@type{import('tailwindcss').Config}*/
302
-
module.exports= {
303
-
theme: {
304
-
// ...
305
-
},
306
-
plugins: [
307
-
require('@tailwindcss/typography')({
308
-
className:'wysiwyg',
309
-
}),
310
-
]
311
-
...
296
+
```css
297
+
@import"tailwindcss";
298
+
@plugin "@tailwindcss/typography" {
299
+
className: wysiwyg;
312
300
}
313
301
```
314
302
@@ -330,7 +318,7 @@ Now every instance of `prose` in the default class names will be replaced by you
330
318
331
319
### Customizing the CSS
332
320
333
-
If you want to customize the raw CSS generated by this plugin, add your overrides under the `typography` key in the `theme` section of your `tailwind.config.js` file:
321
+
If you want to customize the raw CSS generated by this plugin, first follow the steps from [adding custom color themes](#adding-custom-color-themes) to set up a JavaScript based configuration API and then add your overrides under the `typography` key in the `theme` section of your `tailwind.config.js` file:
334
322
335
323
```js {{ filename: 'tailwind.config.js' }}
336
324
/** @type {import('tailwindcss').Config} */
@@ -352,63 +340,30 @@ module.exports = {
352
340
},
353
341
},
354
342
},
355
-
plugins: [
356
-
require('@tailwindcss/typography'),
357
-
// ...
358
-
],
359
-
}
360
-
```
361
-
362
-
Like with all theme customizations in Tailwind, you can also define the `typography` key as a function if you need access to the `theme` helper:
363
-
364
-
```js {{ filename: 'tailwind.config.js' }}
365
-
/**@type{import('tailwindcss').Config}*/
366
-
module.exports= {
367
-
theme: {
368
-
extend: {
369
-
typography: (theme) => ({
370
-
DEFAULT: {
371
-
css: {
372
-
color:theme('colors.gray.800'),
373
-
374
-
// ...
375
-
},
376
-
},
377
-
}),
378
-
},
379
-
},
380
-
plugins: [
381
-
require('@tailwindcss/typography'),
382
-
// ...
383
-
],
384
343
}
385
344
```
386
345
387
-
Note that for certain keys the `theme` function can return a tuple (like for `theme('fontSize.lg')` for example. In these situations, you should make sure to grab the specific part of the tuple you need:
346
+
Like with all theme customizations in Tailwind, you can use CSS variables if you need access to access your theme configuration:
388
347
389
348
```js {{ filename: 'tailwind.config.js' }}
390
349
/**@type{import('tailwindcss').Config}*/
391
350
module.exports= {
392
351
theme: {
393
352
extend: {
394
-
typography:(theme) => ({
353
+
typography: {
395
354
DEFAULT: {
396
355
css: {
397
-
fontSize:theme('fontSize.base')[0],
356
+
color:'var(--color-gray-800)',
398
357
// ...
399
358
},
400
359
},
401
-
}),
360
+
},
402
361
},
403
362
},
404
-
plugins: [
405
-
require('@tailwindcss/typography'),
406
-
// ...
407
-
],
408
363
}
409
364
```
410
365
411
-
Customizations should be applied to a specific modifier like `DEFAULT` or `xl`, and must be added under the `css` property. Customizations are authored in the same [CSS-in-JS syntax](https://tailwindcss.com/docs/plugins#css-in-js-syntax) used to write Tailwind plugins.
366
+
Customizations should be applied to a specific modifier like `DEFAULT` or `xl`, and must be added under the `css` property. Customizations are authored in the same [CSS-in-JS syntax](https://v3.tailwindcss.com/docs/plugins#css-in-js-syntax) used to write Tailwind v3 plugins.
412
367
413
368
See [the default styles](https://github.com/tailwindlabs/tailwindcss-typography/blob/main/src/styles.js) for this plugin for more in-depth examples of configuring each modifier.
0 commit comments