Skip to content

Vite

Create a React project

npm create vite@latest my-app -- --template react-ts
cd my-app
npm install

Configure the import alias

Add this mapping under compilerOptions in both tsconfig.json and tsconfig.app.json. The CLI reads the root config and TypeScript checks application imports against the app config.

{
  "paths": {
    "@/*": ["./src/*"]
  }
}

Add the same alias to vite.config.ts. Keep the plugins that your project already uses.

import { fileURLToPath, URL } from 'node:url'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
})

Install and render the editor

npx @tiptap/cli@latest add simple-editor

Render the installed editor in src/App.tsx.

import { SimpleEditor } from '@/components/tiptap-templates/simple/simple-editor'

export default function App() {
  return <SimpleEditor />
}

Run npm run dev and open /. Run npm run build for a production build.

Add styles

The CLI looks for src/index.css, src/main.css, or src/App.css. Ensure your app imports the stylesheet that contains the shared style imports. Style setup

For an existing editor, you can install individual controls. Heading button