npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

textora-editor

v1.0.1

Published

Everything You Need. Completely Free. A lightweight, feature-rich React rich text editor with essential editing tools and TypeScript support.

Readme

textora-editor

Everything You Need. Completely Free.

npm version React TypeScript npm downloads Bundle Size

A lightweight, feature-rich React rich text editor that stores editable content as HTML and requires no upload service or UI framework.

textora-editor is a controlled rich text editor for React and TypeScript applications. It provides formatting tools, HTML source editing, image and media insertion, local file handling, tables, customizable themes, localization, and RTL support.

Local images, audio, video, and files are read in the browser and embedded in the resulting HTML as Base64 data URLs. Textora does not make upload requests or require a backend endpoint for these actions.

Installation

npm install textora-editor

Or use another package manager:

yarn add textora-editor
pnpm add textora-editor

Textora supports React and React DOM >=18.2.0.

Import the package stylesheet:

import 'textora-editor/styles.css'

Quick start

import { useState } from 'react'
import { Textora } from 'textora-editor'
import 'textora-editor/styles.css'

export default function Example() {
    const [value, setValue] = useState('<p>Hello from Textora.</p>')

    return (
        <>
            <Textora
                title="Article content"
                value={value}
                onChange={setValue}
                placeholder="Start writing..."
            />

            <div
                className="rte-content"
                dangerouslySetInnerHTML={{ __html: value }}
            />
        </>
    )
}

Textora is a controlled component. The value prop contains the editor's HTML content, and onChange receives the updated HTML string.

Important: When rendering the HTML output outside the editor, the wrapper element must have the rte-content class. This class provides the default styling for rendered content, including images and media. Without it, the editor's content styles will not be applied to the displayed HTML.

Built-in themes

Textora includes nine built-in themes. All themes use the same component API and can be changed through the theme prop.

<Textora
    value={value}
    onChange={setValue}
    theme="synthwave"
/>

Localization and supported languages

Textora includes 16 built-in locales for its interface. The locale prop controls toolbar labels, dialogs, validation messages, placeholders, and accessibility labels.

Supported locales:

English, Chinese, Hindi, Spanish, Arabic, French, Bengali, Portuguese, Russian, Urdu, Indonesian, German, Japanese, Nigerian Pidgin, Turkish, and Persian.

<Textora
    value={value}
    onChange={setValue}
    locale="Persian"
    direction="rtl"
/>

The locale and direction props work independently. Changing the interface language does not automatically change the editor's text direction. Use rtl for Persian, Arabic, Urdu, and other right-to-left languages, or ltr for left-to-right content.

Image insertion and customization

The image insertion dialog allows users to add an image using a URL or by selecting a local image file.

You can also specify the image's alternative text, title, dimensions, and CSS classes.

Custom image classes

The image dialog includes a class input. You can enter any CSS class name supported by your application, including Tailwind CSS classes, Bootstrap classes, or your own custom CSS classes.

The entered classes are applied directly to the inserted image element.

<Textora
    value={value}
    onChange={setValue}
    maxImageSize={5 * 1024 * 1024}
/>

maxImageSize controls the maximum allowed size of locally selected images. Its default value is 5 MiB (5 × 1024 × 1024 bytes). This limit does not apply to images inserted through a URL.

Video, audio, and file insertion

Textora supports inserting audio and video through a URL or a local file. The media dialog provides fields for media type, title, alternative text, width, and height.

The file insertion tool allows users to select local files and insert them into the editor as downloadable links when they are not recognized as images, audio, or video.

Local media and files are converted into Base64 data URLs and stored inside the editor's HTML content. No upload request is sent to a server.

HTML source editing

Textora includes an HTML source mode that allows users to view and edit the editor's HTML directly.

Switching back to the visual editor sanitizes the source content before restoring it to the editing surface. The updated HTML is then emitted through onChange.

Pasted and inserted HTML is also sanitized before being added to the editor.

Custom labels

The labels prop allows you to override individual interface texts without creating a complete locale. You can provide custom labels in any language, regardless of the selected locale. For example, if locale="German", you can write your custom labels in German.

<Textora
    value={value}
    onChange={setValue}
    locale="English"
    labels={{
        insertImage: 'Add image',
        insertFile: 'Upload file',
        insertMedia: 'Add media',
        placeholder: 'Write your content...',
    }}
/>

Only the labels you provide are overridden. All other labels continue to use the selected locale.

API reference

Textora props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | value | string | Required | Current HTML content. | | onChange | (value: string) => void | Required | Called with the updated HTML string. | | id | string | Generated | Editor element ID. | | theme | EditorTheme | 'light' | Built-in editor theme. | | title | string | — | Visible editor title and accessible label. | | error | string | — | Error message displayed below the editor. | | placeholder | string | Locale default | Placeholder displayed when the editor is empty. | | direction | TextDirection | 'ltr' | Editor and interface direction. | | locale | TextoraLocale | 'English' | Interface language. | | minHeight | number | 260 | Editor minimum height in pixels. | | disabled | boolean | false | Disables editor interactions. | | className | string | '' | Additional class applied to the editor root. | | labels | Partial<TextoraLabels> | — | Custom interface label overrides. | | maxImageSize | number | 5242880 | Maximum local image size in bytes. |

TypeScript types

Textora exports its component and public types:

import {
    Textora,
    type TextoraProps,
    type EditorTheme,
    type TextDirection,
    type TextoraLocale,
    type TextoraLabels,
} from 'textora-editor'

Styling and customization

Import textora-editor/styles.css to apply the editor's default styles.

The className prop allows you to add a custom class to the editor's root element. Textora also uses scoped CSS classes and custom properties, making it possible to customize the editor without affecting unrelated application elements.

<Textora
    value={value}
    onChange={setValue}
    className="my-custom-editor"
/>
.rte-root.my-custom-editor {
    max-width: 900px;
}

Development

Clone the repository, install dependencies, and run the available scripts:

npm install
npm run typecheck
npm run build
npm run lint
npm run pack:check

| Command | Purpose | | --- | --- | | npm run typecheck | Run TypeScript checks. | | npm run build | Build the library and generate declaration files. | | npm run lint | Run the configured TypeScript check. | | npm run pack:check | Preview the npm package contents without publishing. |

License

MIT. See LICENSE.