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.
184
+
Read the Tailwind CSS documentation on [stacked modifiers](https://tailwindcss.com/docs/hover-focus-and-other-states) to learn more.
193
185
194
186
### Overriding max-width
195
187
@@ -234,7 +226,15 @@ Note that you can't nest new `prose` instances within a `not-prose` block at thi
234
226
235
227
### Adding custom color themes
236
228
237
-
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:
229
+
To customize the color theme beyond simple CSS overrides, you can use the JavaScript based theme API. To do that, use the `@config` directive:
230
+
231
+
```diff
232
+
@import "tailwindcss";
233
+
@plugin "@tailwindcss/typography";
234
+
+ @config "./tailwind.config.js";
235
+
```
236
+
237
+
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:
@@ -294,18 +290,10 @@ See our internal [style definitions](https://github.com/tailwindlabs/tailwindcss
294
290
295
291
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:
296
292
297
-
```js {{ filename: 'tailwind.config.js' }}
298
-
/**@type{import('tailwindcss').Config}*/
299
-
module.exports= {
300
-
theme: {
301
-
// ...
302
-
},
303
-
plugins: [
304
-
require('@tailwindcss/typography')({
305
-
className:'wysiwyg',
306
-
}),
307
-
]
308
-
...
293
+
```css
294
+
@import"tailwindcss";
295
+
@plugin "@tailwindcss/typography" {
296
+
className: wysiwyg;
309
297
}
310
298
```
311
299
@@ -327,7 +315,7 @@ Now every instance of `prose` in the default class names will be replaced by you
327
315
328
316
### Customizing the CSS
329
317
330
-
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:
318
+
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:
331
319
332
320
```js {{ filename: 'tailwind.config.js' }}
333
321
/** @type {import('tailwindcss').Config} */
@@ -349,63 +337,30 @@ module.exports = {
349
337
},
350
338
},
351
339
},
352
-
plugins: [
353
-
require('@tailwindcss/typography'),
354
-
// ...
355
-
],
356
-
}
357
-
```
358
-
359
-
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:
360
-
361
-
```js {{ filename: 'tailwind.config.js' }}
362
-
/**@type{import('tailwindcss').Config}*/
363
-
module.exports= {
364
-
theme: {
365
-
extend: {
366
-
typography: (theme) => ({
367
-
DEFAULT: {
368
-
css: {
369
-
color:theme('colors.gray.800'),
370
-
371
-
// ...
372
-
},
373
-
},
374
-
}),
375
-
},
376
-
},
377
-
plugins: [
378
-
require('@tailwindcss/typography'),
379
-
// ...
380
-
],
381
340
}
382
341
```
383
342
384
-
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:
343
+
Like with all theme customizations in Tailwind, you can use CSS variables if you need access to access your theme configuration:
385
344
386
345
```js {{ filename: 'tailwind.config.js' }}
387
346
/**@type{import('tailwindcss').Config}*/
388
347
module.exports= {
389
348
theme: {
390
349
extend: {
391
-
typography:(theme) => ({
350
+
typography: {
392
351
DEFAULT: {
393
352
css: {
394
-
fontSize:theme('fontSize.base')[0],
353
+
color:'var(--color-gray-800)',
395
354
// ...
396
355
},
397
356
},
398
-
}),
357
+
},
399
358
},
400
359
},
401
-
plugins: [
402
-
require('@tailwindcss/typography'),
403
-
// ...
404
-
],
405
360
}
406
361
```
407
362
408
-
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.
363
+
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.
409
364
410
365
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