This is a Minimal Tiptap Editor Component built for Shadcn. It provides a simple and clean editor for users to write and format text.
Before you can use the Minimal Tiptap Editor Component, you need to install the following packages:
npm install @tiptap/core @tiptap/extension-heading @tiptap/extension-horizontal-rule @tiptap/extension-image @tiptap/extension-link @tiptap/pm @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder @tiptap/extension-task-item @tiptap/extension-task-list @tiptap/extension-typography @tiptap/extension-code-block-lowlight @tiptap/extension-color @tiptap/extension-text-style lowlightThe Minimal Tiptap Editor Component depends on the following components from Shadcn:
Next, copy the minimal-tiptap directory and paste into your project. The code is yours to use and modify.
The Minimal Tiptap Editor Component accepts all the props from the Tiptap Editor Component. The following are additional props:
valueis the initial value of the editor.onChangeis a function that receives the value of the editor.editorContentClassNameis a string to add a class to theEditorContentcomponent.outputis the format of the output value. It can be'html','json', or'text'. Default is'html'.placeholderis a string to display as a placeholder in the editor.editorClassNameis a string to add a class to theuseEditorhooks. which is the editor itself.throttleDelayis a number to delay the throttle of the editor. Default is1000.
import { useState } from 'react'
import { MinimalTiptapEditor } from './minimal-tiptap'
export const App = () => {
const [value, setValue] = useState('')
return (
<MinimalTiptapEditor
value={value}
onChange={setValue}
throttleDelay={2000}
className="w-full"
editorContentClassName="p-5"
output="html"
placeholder="Type your description here..."
autofocus={true}
immediatelyRender={true}
editable={true}
injectCSS={true}
shouldRerenderOnTransaction={false}
editorClassName="focus:outline-none"
/>
)
}This project is licensed under the MIT License - see the LICENSE file for details.