gitmyhub

draft-js

JavaScript ★ 23k updated 3y ago ▣ archived

A React framework for building text editors.

A JavaScript framework for building rich text editors in React apps, with support for formatting, links, media, and custom styles. Now archived, Meta recommends Lexical for new projects.

JavaScriptReactsetup: easycomplexity 3/5

Draft.js is a JavaScript framework for building rich text editors — the kind where you can bold text, add links, embed media, or apply custom formatting, all inside a web app. It was created by Meta (Facebook) and used in products like Facebook Notes and Messenger.

The idea is that building a good text editor from scratch is notoriously tricky: you have to deal with browser quirks, cursor behavior, undo/redo, and more. Draft.js handles all of that complexity and gives developers building blocks they can customize. It integrates directly into React apps using a model where the editor's entire state is stored in an immutable snapshot — meaning every change produces a new version of the state rather than mutating the old one. This makes undo/redo and collaborative editing patterns much easier to build.

You would use Draft.js when you need a text editor in a React application that goes beyond a plain textarea — for example, a social media post composer, a comment box with formatting, or a document editor.

Important note: this project is archived and no longer receiving new features. Meta has since moved to a successor called Lexical, which they recommend for new projects. The stack is JavaScript and React.

Where it fits