Skip to content

Commit 39b63fe

Browse files
authored
Merge pull request #186 from n14little/note-on-css-modules
chore: add note on css modules
2 parents 7ef10b4 + 0cff276 commit 39b63fe

File tree

2 files changed

+38
-24
lines changed

2 files changed

+38
-24
lines changed

.changeset/fast-guests-brush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tiptap-docs': patch
3+
---
4+
5+
Add a note on styling with css modules

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

Lines changed: 33 additions & 24 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

0 commit comments

Comments
 (0)