Gathering detailed insights and metrics for rich-textarea
Gathering detailed insights and metrics for rich-textarea
Gathering detailed insights and metrics for rich-textarea
Gathering detailed insights and metrics for rich-textarea
react-quill
The Quill rich-text editor as a React component.
rich-html-textarea
This HTML textarea component includes features such as displaying line numbers for each line of text in the textarea, and allowing users to copy the contents of the textarea to the clipboard with the click of a button
react-quill-new
The Quill rich-text editor as a React component.
react-quill-with-table
The Quill rich-text editor as a React component.
A small customizable textarea for React to colorize, highlight, decorate texts, offer autocomplete and much more.
npm install rich-textarea
Typescript
Module System
Node Version
NPM Version
88.1
Supply Chain
98.5
Quality
83.6
Maintenance
100
Vulnerability
100
License
TypeScript (97.98%)
JavaScript (2.02%)
Total Downloads
651,022
Last Day
571
Last Week
12,990
Last Month
53,875
Last Year
520,773
MIT License
372 Stars
631 Commits
10 Forks
3 Watchers
9 Branches
5 Contributors
Updated on Jun 18, 2025
Minified
Minified + Gzipped
Latest Version
0.26.4
Package Id
rich-textarea@0.26.4
Unpacked Size
239.04 kB
Size
45.99 kB
File Count
20
NPM Version
10.7.0
Node Version
22.2.0
Published on
Nov 07, 2024
Cumulative downloads
Total Downloads
Last Day
87.8%
571
Compared to previous day
Last Week
-9.1%
12,990
Compared to previous week
Last Month
-8.9%
53,875
Compared to previous month
Last Year
440.8%
520,773
Compared to previous year
1
51
A small customizable textarea for React to colorize, highlight, decorate texts, offer autocomplete and much more.
[!NOTE] You may also like https://github.com/inokawa/edix
https://inokawa.github.io/rich-textarea/
Sometimes we need customized text editor in web. However creating it with raw contenteditable is so hard to do properly and editor frameworks are usually too heavy... Maybe you really need is just a textarea with highlighting and some hovered menus, but native textarea and many of textarea libraries are far from it because of the limited customizability. This library is aiming to solve the problem.
1npm install rich-textarea
If you use ESM and webpack 5, use react >= 18 to avoid Can't resolve react/jsx-runtime
error.
1import { useState } from "react"; 2import { RichTextarea } from "rich-textarea"; 3 4export const App = () => { 5 const [text, setText] = useState("Lorem ipsum"); 6 7 return ( 8 <RichTextarea 9 value={text} 10 style={{ width: "600px", height: "400px" }} 11 onChange={(e) => setText(e.target.value)} 12 > 13 {(v) => { 14 return v.split("").map((t, i) => ( 15 <span key={i} style={{ color: i % 2 === 0 ? "red" : undefined }}> 16 {t} 17 </span> 18 )); 19 }} 20 </RichTextarea> 21 ); 22};
1import { RichTextarea } from "rich-textarea"; 2 3export const App = () => { 4 return ( 5 <RichTextarea 6 defaultValue="Lorem ipsum" 7 style={{ width: "600px", height: "400px" }} 8 > 9 {(v) => { 10 return v.split("").map((t, i) => ( 11 <span key={i} style={{ color: i % 2 === 0 ? "red" : undefined }}> 12 {t} 13 </span> 14 )); 15 }} 16 </RichTextarea> 17 ); 18};
You can use helper for regex if you don't want to create your own render function.
1import { useState } from "react"; 2import { RichTextarea, createRegexRenderer } from "rich-textarea"; 3 4const renderer = createRegexRenderer([ 5 [/[A-Z][a-z]+/g, { borderRadius: "3px", backgroundColor: "#d0bfff" }], 6]); 7 8export const App = () => { 9 const [text, setText] = useState("Lorem ipsum"); 10 11 return ( 12 <RichTextarea 13 value={text} 14 style={{ width: "600px", height: "400px" }} 15 onChange={(e) => setText(e.target.value)} 16 > 17 {renderer} 18 </RichTextarea> 19 ); 20};
1// _components/Textarea.tsx 2"use client"; 3import { RichTextarea, RichTextareaProps } from "rich-textarea"; 4 5export const Textarea = ( 6 props: Omit<RichTextareaProps, "children" | "ref"> 7) => { 8 return ( 9 <RichTextarea {...props}> 10 {(v) => { 11 return v.split("").map((t, i) => ( 12 <span key={i} style={{ color: i % 2 === 0 ? "red" : undefined }}> 13 {t} 14 </span> 15 )); 16 }} 17 </RichTextarea> 18 ); 19}; 20 21// page.tsx in App Router of Next.js 22import { Textarea } from "../_components/Textarea"; 23 24async function hello(formData: FormData) { 25 "use server"; 26 console.log(formData.get("hello")); 27} 28 29export default () => { 30 return ( 31 <div> 32 <div>this is server!</div> 33 <form action={hello}> 34 <Textarea defaultValue="Lorem ipsum" name="hello" /> 35 <button type="submit">submit</button> 36 </form> 37 </div> 38 ); 39};
1import type { ActionFunction } from "@remix-run/node"; 2import { Form } from "@remix-run/react"; 3import { RichTextarea, RichTextareaProps } from "rich-textarea"; 4 5const Textarea = (props: Omit<RichTextareaProps, "children" | "ref">) => { 6 return ( 7 <RichTextarea {...props}> 8 {(v) => { 9 return v.split("").map((t, i) => ( 10 <span key={i} style={{ color: i % 2 === 0 ? "red" : undefined }}> 11 {t} 12 </span> 13 )); 14 }} 15 </RichTextarea> 16 ); 17}; 18 19export const action: ActionFunction = async ({ request }) => { 20 console.log((await request.formData()).get("hello")); 21}; 22 23export default () => { 24 return ( 25 <Form method="post"> 26 <Textarea defaultValue="Lorem ipsum" name="hello" /> 27 <button type="submit">submit</button> 28 </Form> 29 ); 30};
All contributions are welcome. If you find a problem, feel free to create an issue or a PR.
npm install
.No vulnerabilities found.
No security vulnerabilities found.