Lexical Text Editor Framework

Lexical Text Editor Framework

lexical.dev

2

About this website

Lexical is an extensible JavaScript web text editor framework created by Meta, designed to prioritize reliability, accessibility, and performance while remaining lean and modular. The core editor weighs approximately 22KB gzipped and deliberately avoids bundling UI components or rich-text features, instead exposing a plugin architecture where functionality is composed from independent packages covering lists, links, tables, code highlighting, markdown, mentions, and more. The internal architecture represents document content as an immutable node tree where each editor state is a snapshot that can be serialized to JSON and restored deterministically, enabling undo and redo through state transitions rather than mutation tracking. State updates are batched and applied atomically through functions that receive a mutable draft, ensuring consistency. The node system supports custom element nodes and text nodes with extensible marks, while decorator nodes enable embedding React components such as polls or interactive widgets directly within the document flow. Accessibility is treated as a first-class concern, with ARIA attributes, keyboard navigation, and screen reader compatibility following WCAG guidelines tested across major assistive technologies. Selection modeling works through a range-based system that tracks anchor and focus offsets independent of DOM selection, providing reliable programmatic control over cursor position. The framework includes reference implementations for rich text editing, Notion-style block editors with slash commands and drag handles, chat input with mention suggestions, and AI-powered content transformations using in-browser models compiled to WebAssembly. Meta uses this framework in production across Facebook, Threads, and Messenger, and the project has over 20 thousand GitHub stars with active contributions from both Meta engineers and the open source community.

Tags & Categories

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!