PACKAGE · RICH TEXT EDITOR

lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessible and performance.

WEEKLY DOWNLOADS 3.8M
STARS 23.7K
FORKS 2.2K
OPEN ISSUES 358
GZIP SIZE 60.2 kB
UNPACKED SIZE 3.3 MB
DEPENDENCIES 1
LAST UPDATED 5mo ago
DOWNLOAD TRENDS

lexical downloads — last 12 months

Download trends for lexical1 download series from Aug 2025 to Jul 2026. Use left and right arrow keys to inspect monthly values.04.7M9.4M14.1M18.9MAug 2025NovFebMayJul 2026
lexical
ABOUT LEXICAL

Lexical is an extensible JavaScript framework for building rich text editors, designed to address the inherent complexities of content manipulation in web applications. It provides a robust foundation for creating highly customizable and performant editing experiences, tackling common issues like state management, undo/redo history, and cross-browser compatibility.

The core philosophy behind Lexical emphasizes immutability and a declarative approach to state management, making it easier to reason about editor changes and build complex features. It is primarily aimed at developers building custom content editing solutions who require fine-grained control over the editor's behavior and appearance.

Lexical utilizes a node-based architecture, representing editor content as a tree of nodes rather than a simple string or HTML. Developers interact with the editor through core concepts like `EditorState`, `LexicalEditor`, and event plugins. The framework exposes hooks like `useLexicalComposerContext` and `useEditor` to manage and interact with the editor instance.

Integration into existing applications is streamlined, particularly within React environments. Lexical provides components and hooks designed to work seamlessly with React's ecosystem, allowing developers to embed sophisticated editing capabilities into their applications. Its plugin system also facilitates integration with other libraries and custom functionalities.

With a bundle size of 60.2 kB (gzip), Lexical offers a balance between feature richness and performance. The framework's commitment to accessibility and reliability ensures that editors built with Lexical are dependable and usable across various platforms and for all users.

While highly extensible, developers should be aware that the node-based architecture requires a shift in thinking compared to traditional DOM manipulation for text editing. Building highly specialized custom nodes and transformations can introduce a learning curve, especially for complex formatting or custom element requirements.

WHEN TO USE
  • When developing a custom rich text editor interface requiring fine-grained control over formatting, inline tools, and custom node types.
  • When building collaborative editing features that benefit from a robust, event-driven state management system.
  • When integrating a flexible editing solution into a React-based application that needs to handle complex content structures.
  • When accessibility is a primary concern and a WCAG-compliant editing experience is required out-of-the-box.
  • When implementing features like deep linking, character counts, or custom selection handling within the editor state.
  • When leveraging the plugin architecture to extend editor functionality with custom commands and state transformations.
WHEN NOT TO USE
  • If your content editing needs are limited to simple text input, consider using standard HTML input elements or lighter state management solutions like React's `useState`.
  • If you require a WYSIWYG editor with minimal customization and a very small footprint, a more opinionated, less extensible rich text editor library might be more suitable.
  • If your project strictly forbids external dependencies and requires an entirely DOM-native solution without a framework abstraction.
  • If you are only displaying static content and do not require any user interaction or editing capabilities, a simpler rendering approach is recommended.
  • When integrating into non-JavaScript environments where direct DOM manipulation is the primary strategy and framework integration is not feasible.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 4
lexical vs quill ★ 47.3K · 9.2M/wk lexical vs prosemirror-state ★ 232 · 14.0M/wk lexical vs slate ★ 31.7K · 2.4M/wk lexical vs @tiptap/core ★ 37.9K · 13.7M/wk