Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions docs/content/docs/getting-started/shadcn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,31 @@ To use BlockNote with ShadCN, you can import `BlockNoteView` from `@blocknote/sh
To ensure Tailwind generates the necessary CSS for all utility classes used by BlockNote components, make sure to add the `@source` directive to your stylesheet that imports Tailwind:

```css
@import tailwindcss;
@import "tailwindcss";
...
/* Path to your installed `@blocknote/shadcn` package. */
@source "../node_modules/@blocknote/shadcn";
```

{/* TODO: Figure out why `@source` directive isn't working in StackBlitz sandbox. */}
{/* https://stackblitz.com/edit/github-xdutga97?file=src%2FApp.tsx */}

<Callout type={"warning"}>
Because the ShadCN version of BlockNote requires being in a Tailwind app,
viewing the demo below on StackBlitz will have missing styles.
</Callout>

<Example name="basic/shadcn" />

## Usage with Tailwind Only

If your app doesn't use ShadCN components and only uses TailwindCSS, you just need to extend your Tailwind theme with ShadCN utility classes to get ecerything working. You can do this by simply copying the styles below into your stylesheet that imports Tailwind.
If your app doesn't use ShadCN components and only uses TailwindCSS, you just need to extend your Tailwind theme with ShadCN utility classes to get everything working. You can do this by simply copying the styles below into your stylesheet that imports Tailwind.

```css
@import tailwindcss;
@import "tailwindcss";
...
/* Path to your installed `@blocknote/shadcn` package. */
@source "../node_modules/@blocknote/shadcn";
...
@custom-variant dark (&:is(.dark *));

Expand Down
5 changes: 5 additions & 0 deletions examples/01-basic/09-shadcn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This example shows how you can use BlockNote with ShadCN (instead of Mantine).

<Callout type={"warning"}>
Because the ShadCN version of BlockNote requires being in a Tailwind app,
viewing the demo below on StackBlitz will have missing styles.
</Callout>

**Relevant Docs:**

- [Getting Started with ShadCN](/docs/getting-started/shadcn)
2 changes: 1 addition & 1 deletion playground/src/examples.gen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"pathFromRoot": "examples/01-basic",
"slug": "basic"
},
"readme": "This example shows how you can use BlockNote with ShadCN (instead of Mantine).\n\n**Relevant Docs:**\n\n- [Getting Started with ShadCN](/docs/getting-started/shadcn)"
"readme": "This example shows how you can use BlockNote with ShadCN (instead of Mantine).\n\n<Callout type={\"warning\"}>\nBecause the ShadCN version of BlockNote requires being in a Tailwind app,\nviewing the demo below on StackBlitz will have missing styles.\n</Callout>\n\n**Relevant Docs:**\n\n- [Getting Started with ShadCN](/docs/getting-started/shadcn)"
},
{
"projectSlug": "localization",
Expand Down
Loading