"use client"; import { BlockNoteContext } from "@blocknote/react"; import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock"; import { Tab, Tabs } from "fumadocs-ui/components/tabs"; import { useTheme } from "next-themes"; import dynamic from "next/dynamic"; import { AiFillGithub } from "react-icons/ai"; import { SiStackblitz } from "react-icons/si"; import CTAButton from "@/components/CTAButton"; import { SectionHeader } from "@/components/Headings"; import { ExampleData } from "@/components/example/generated/exampleGroupsData.gen"; import { authClient } from "@/lib/auth-client"; import * as Sentry from "@sentry/nextjs"; function ExampleDemoBarSourceCodeLink(props: { name: string; icon: React.ReactNode; url: string; }) { return ( {props.icon}
{props.name}
); } function ExampleDemoBar(props: { exampleData: ExampleData }) { return (
} url={`https://github.com/TypeCellOS/BlockNote/tree/main/${props.exampleData.pathFromRoot}`} /> {props.exampleData.showStackBlitzLink && ( } url={`https://www.stackblitz.com/github/TypeCellOS/BlockNote/tree/main/${props.exampleData.pathFromRoot}`} /> )}
); } function ExampleDemo(props: { exampleData: ExampleData }) { const Component = dynamic( () => import( "./example/generated/components/" + props.exampleData.exampleGroupName + "/" + props.exampleData.exampleName + "/index" ), { ssr: false }, ); const { resolvedTheme } = useTheme(); return (
); } function ExampleCode(props: { exampleData: ExampleData }) { return ( {Object.entries(props.exampleData.files).map( ([fileName, fileContent]) => ( ), )} ); } function ExampleProPrompt() { return (
Pro Example

Get access to the full source code for pro examples by subscribing to BlockNote Pro

Get BlockNote Pro
{/* {!props.isProExample?.userStatus && (

Or{" "} {" "} via GitHub

)} */}
); } export default function Example(props: { exampleData: ExampleData }) { const session = authClient.useSession(); const userIsPro = session.data && session.data.planType !== "free"; return ( We encountered an error trying to show this example. Please report this to us on GitHub at{" "} https://github.com/TypeCellOS/BlockNote/issues } >
{props.exampleData.isPro && !userIsPro ? ( ) : ( )}
); }