UNPKG

react-typeflux

Version:

A lightweight, modern, and customizable rich text editor and viewer for React.

97 lines (67 loc) β€’ 2.07 kB
# React Typeflux A lightweight, easy-to-use rich text editor and viewer for React applications. ## ✨ Features - πŸ“ Rich text editing - πŸ‘€ Built-in viewer - 🎨 Pre-styled with TailwindCSS (no extra setup needed) - πŸ“‹ Supports rich paste (copy-paste formatted text) ## πŸ“¦ Installation ```bash npm install react-typeflux ``` or with yarn: ```bash yarn add react-typeflux ``` ## πŸš€ Usage ```jsx import React, { useState } from "react"; import { RichTextEditor, RichTextViewer } from "react-typeflux"; import "react-typeflux/dist/react-typeflux.css"; const MyEditor = () => { const [content, setContent] = useState(""); return ( <div> <RichTextEditor value={content} onChange={setContent} placeholder="Write your blog content…" allowRichPaste /> <h2 className="mt-4 font-bold">Preview</h2> <RichTextViewer value={content} /> </div> ); }; export default MyEditor; ``` ## βš™οΈ Props ### `<RichTextEditor />` | Prop | Type | Default | Description | |-----------------|------------|-----------|-------------| | `value` | `string` | `""` | The editor's current content | | `onChange` | `function` | `() => {}`| Callback when content changes | | `placeholder` | `string` | `""` | Placeholder text | | `allowRichPaste`| `boolean` | `false` | Whether to allow pasting rich text | ### `<RichTextViewer />` | Prop | Type | Default | Description | |----------|----------|---------|-------------| | `value` | `string` | `""` | The content to render | ## πŸ›  Development To build locally: ```bash git clone https://github.com/haryomidey/react-typeflux.git cd react-typeflux npm install npm run dev ``` To build for production: ```bash npm run build ``` --- ## πŸ“œ License This project is licensed under the **MIT License**. --- ## πŸ‘€ Author **Ayotech** – [Portfolio](https://portfolio-six-flax-15.vercel.app/)