A powerful, feature-rich React text editor built on Tiptap with MS Word-like capabilities.
- π Rich Text Editing - Bold, italic, underline, strikethrough, subscript, superscript
- π¨ Text Styling - Font sizes, text colors, highlight colors
- π Formatting - Headings (H1-H3), blockquotes, code blocks
- π Lists - Bullet lists, ordered lists
- π Links - Insert and edit hyperlinks
- πΌοΈ Media - Images (upload/URL), YouTube videos
- π Tables - Full table support with resizable columns
βοΈ Text Alignment - Left, center, right, justify- β©οΈ History - Undo/Redo support
- π Theming - Light/Dark theme with localStorage sync
- π Resizable - Adjustable editor height with drag handle
- π§ Customizable - Modular toolbar configuration
npm install @indoui/react-text-editor
# or
yarn add @indoui/react-text-editor
# or
pnpm add @indoui/react-text-editorimport { TextEditor } from '@indoui/react-text-editor';
import '@indoui/react-text-editor/styles.css';
function App() {
const [content, setContent] = useState('');
return (
<TextEditor
value={content}
onChange={setContent}
placeholder="Start typing..."
/>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
value |
string |
'' |
HTML content (controlled) |
onChange |
(html: string) => void |
- | Callback when content changes |
placeholder |
string |
'Start typing...' |
Placeholder text |
disabled |
boolean |
false |
Disable the editor |
autoFocus |
boolean |
false |
Auto focus on mount |
className |
string |
'' |
Custom class name |
minHeight |
string | number |
200 |
Minimum height |
maxHeight |
string | number |
- | Maximum height (enables scrolling) |
height |
string | number |
- | Initial height |
minWidth |
string | number |
200 |
Minimum width |
maxWidth |
string | number |
- | Maximum width |
width |
string | number |
- | Initial width |
resizable |
boolean |
false |
Enable resize handle |
theme |
'light' | 'dark' |
auto | Theme override |
toolbar |
ToolbarConfig |
all enabled | Toolbar configuration |
You can customize which toolbar buttons are shown:
<TextEditor
value={content}
onChange={setContent}
toolbar={{
bold: true,
italic: true,
underline: true,
strikethrough: false, // Hide strikethrough
subscript: false,
superscript: false,
bulletList: true,
orderedList: true,
headings: true,
textAlign: true,
link: true,
image: true,
video: false, // Hide video button
table: true,
fontSize: true,
textColor: true,
highlight: true,
blockquote: true,
codeBlock: true,
horizontalRule: true,
history: true,
}}
/>Enable the resize handle to let users adjust editor height:
<TextEditor
value={content}
onChange={setContent}
resizable={true}
minHeight={200}
maxHeight={600}
/>The editor automatically syncs with localStorage.getItem('theme'). You can also override it:
// Auto theme (from localStorage)
<TextEditor value={content} onChange={setContent} />
// Force light theme
<TextEditor value={content} onChange={setContent} theme="light" />
// Force dark theme
<TextEditor value={content} onChange={setContent} theme="dark" />import { setTheme, toggleTheme, useTheme } from '@indoui/react-text-editor';
// Programmatically set theme
setTheme('dark');
// Toggle between light/dark
toggleTheme();
// React hook for current theme
const theme = useTheme();import {
TextEditor,
Toolbar,
ToolbarButton,
FontSize,
} from '@indoui/react-text-editor';const [html, setHtml] = useState('');
<TextEditor
value={html}
onChange={(newHtml) => {
setHtml(newHtml);
console.log('HTML output:', newHtml);
}}
/>If you want to build the library yourself:
# Clone the repository
git clone https://github.com/indoui/react-text-editor.git
cd react-text-editor
# Install dependencies
npm install
# Build the library
npm run build:lib
# The output will be in the dist/ folderFull TypeScript support with exported types:
import type {
TextEditorProps,
ToolbarConfig,
EditorTheme
} from '@indoui/react-text-editor';- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
MIT Β© IndoUI