Skip to content

Commit 0cff276

Browse files
committed
fix: use callout to show css modules warning
1 parent e001f50 commit 0cff276

File tree

1 file changed

+33
-26
lines changed
  • src/content/editor/getting-started/style-editor

1 file changed

+33
-26
lines changed

src/content/editor/getting-started/style-editor/index.mdx

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,43 @@
22
title: Styling the Editor
33
meta:
44
title: Style your editor | Tiptap Editor Docs
5-
description: Apply custom styles to your Tiptap editor using plain HTML, custom classes, or Tailwind CSS. Learn more in the docs!
5+
description: Apply custom styles to your Tiptap editor using plain HTML, custom classes, or Tailwind CSS. Learn more in the docs.
66
category: Editor
77
---
88

9+
import { ArrowRightIcon } from 'lucide-react'
10+
import contentTemplatesImage from '@/assets/content-templates.png'
911
import { CodeDemo } from '@/components/CodeDemo'
12+
import * as ImageCard from '@/components/ImageCard'
1013
import Link from '@/components/Link'
11-
import { ArrowRightIcon } from 'lucide-react'
1214
import { Button } from '@/components/ui/Button'
13-
import * as ImageCard from '@/components/ImageCard'
14-
import contentTemplatesImage from '@/assets/content-templates.png'
15-
15+
import { Callout } from '@/components/ui/Callout'
1616

1717
Tiptap is headless, which means there is no styling provided. That also means you are in full control of how your editor looks. The following methods allow you to apply custom styles to the editor.
1818

1919
<ImageCard.Card>
20-
<ImageCard.Image src={contentTemplatesImage.src} alt="User interface templates for Tiptap" />
21-
<ImageCard.Content>
22-
<ImageCard.Title>Wanna take a shortcut?</ImageCard.Title>
23-
<ImageCard.Paragraph>Speed up your Tiptap integration into your React app with our UI template. It's ready for deployment as-is or can be customized to your needs.</ImageCard.Paragraph>
24-
<div className="flex items-center gap-2 mt-8">
25-
<Button asChild variant="secondary">
26-
<Link href="https://templates.tiptap.dev/">
27-
Try demo
28-
<ArrowRightIcon className="size-4" />
29-
</Link>
30-
</Button>
31-
<Button asChild variant="tertirary">
32-
<Link href="https://cloud.tiptap.dev/react-templates">
33-
Get access
34-
<ArrowRightIcon className="size-4" />
35-
</Link>
36-
</Button>
37-
</div>
38-
</ImageCard.Content>
20+
<ImageCard.Image src={contentTemplatesImage.src} alt="User interface templates for Tiptap" />
21+
<ImageCard.Content>
22+
<ImageCard.Title>Wanna take a shortcut?</ImageCard.Title>
23+
<ImageCard.Paragraph>
24+
Speed up your Tiptap integration into your React app with our UI template. It$apos;s ready for
25+
deployment as-is or can be customized to your needs.
26+
</ImageCard.Paragraph>
27+
<div className="flex items-center gap-2 mt-8">
28+
<Button asChild variant="secondary">
29+
<Link href="https://templates.tiptap.dev/">
30+
Try demo
31+
<ArrowRightIcon className="size-4" />
32+
</Link>
33+
</Button>
34+
<Button asChild variant="tertirary">
35+
<Link href="https://cloud.tiptap.dev/react-templates">
36+
Get access
37+
<ArrowRightIcon className="size-4" />
38+
</Link>
39+
</Button>
40+
</div>
41+
</ImageCard.Content>
3942
</ImageCard.Card>
4043

4144
## Style plain HTML
@@ -49,6 +52,12 @@ The entire editor is rendered inside a container with the class `.tiptap`. You c
4952
}
5053
```
5154

55+
<Callout title="Style with CSS modules" variant="warning">
56+
In [CSS modules](https://github.com/css-modules/css-modules), class names are modified to enable
57+
local scoping, which may prevent styles from applying when targeting the `.tiptap` class. Use
58+
global styles or the `:global(.tiptap)` modifier to ensure styles are applied correctly.
59+
</Callout>
60+
5261
If you're rendering the stored content elsewhere, there won't be a `.tiptap` container, so you can globally add styling to the relevant HTML tags:
5362

5463
```css
@@ -58,8 +67,6 @@ p {
5867
}
5968
```
6069

61-
**_Note:_** When using CSS modules, class names are modified to enable local scoping, which may prevent styles from applying if targeting the .tiptap class. Use global styles or the :global(.tiptap) modifier in your CSS module to ensure styles are applied correctly.
62-
6370
## Add custom classes
6471

6572
You can control the whole rendering, including adding classes to everything.

0 commit comments

Comments
 (0)