MCPcopy Index your code
hub / github.com/facebook/lexical

github.com/facebook/lexical @v0.46.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.46.0 ↗
6,787 symbols 31,320 edges 1,120 files 465 documented · 7% 73 cross-repo links
README

Lexical

An extensible text editor framework that provides excellent reliability, accessibility and performance.

NPM Version NPM Downloads Build Status Discord

Documentation | Getting Started | Playground | Gallery

Features

  • Framework Agnostic Core - Works with any UI framework, with official React bindings
  • Reliable & Accessible - Built-in accessibility support and WCAG compliance
  • Extensible - Plugin-based architecture with powerful extension points
  • Immutable State Model - Time-travel ready with built-in undo/redo
  • Collaborative Editing - Real-time collaboration via Yjs integration
  • Serialization - Import/export from JSON, Markdown, and HTML
  • Rich Content - Support for tables, lists, code blocks, images, and custom nodes
  • Cross-browser - Firefox 115+, Safari 15+, Chrome 86+ (see Supported Browsers)
  • Type Safe - Written in TypeScript with comprehensive type definitions

Quick Start

npm install lexical @lexical/react
import { $getRoot, $getSelection } from 'lexical';
import { LexicalComposer } from '@lexical/react/LexicalComposer';
import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin';
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';

const initialConfig = {
  namespace: 'MyEditor',
  onError: (error) => console.error(error),
};

function Editor() {
  return (
    <LexicalComposer initialConfig={initialConfig}>
      <PlainTextPlugin
        contentEditable={<ContentEditable />}
        ErrorBoundary={LexicalErrorBoundary}
      />
      <HistoryPlugin />
    </LexicalComposer>
  );
}

Try it yourself: - Plain Text Example - Rich Text Example

Development

# Install dependencies
pnpm install

# Start playground dev server
pnpm run start

# Run tests
pnpm run test-unit
pnpm run test-e2e-chromium

# Lint and type check
pnpm run ci-check

See CONTRIBUTING.md for detailed development guidelines.

Documentation

Community & Support

Browser Support

Browser Version
Chrome 86+
Firefox 115+
Safari 15+
Edge 86+

Contributors

We welcome contributions! Please read our Contributing Guide to learn about our development process and how to propose bugfixes and improvements.

License

MIT License Copyright ©2026 Meta Platforms, Inc.

Extension points exported contracts — how you extend this code

BaseSelection (Interface)
(no doc) [6 implementers]
packages/lexical/src/LexicalSelection.ts
RenderContextReader (Interface)
(no doc) [3 implementers]
packages/lexical-html/src/types.ts
YAbstractType (Interface)
(no doc) [3 implementers]
libdefs/yjs.js
Provider (Interface)
(no doc) [2 implementers]
packages/lexical-yjs/src/index.ts
DynamicSettings (Interface)
* The *only* settings that require tearing down and rebuilding the editor, * because they change the set of extensions
packages/lexical-playground/src/App.tsx
HistoryExtensionInit (Interface)
Internal writable signals created during the init phase.
packages/lexical-history/src/index.ts
EventCounts (Interface)
(no doc) [1 implementers]
flow-typed/environments/bom.js
ErrorBoundaryState (Interface)
(no doc)
packages/lexical-react/src/LexicalErrorBoundary.tsx

Core symbols most depended-on inside this repo

update
called by 2030
packages/lexical-html/src/import/types.ts
append
called by 1693
packages/lexical-list/src/LexicalListItemNode.ts
$createTextNode
called by 1426
packages/lexical/src/nodes/LexicalTextNode.ts
$getRoot
called by 1378
packages/lexical-devtools/src/lexicalForExtension.ts
$createParagraphNode
called by 1148
packages/lexical/src/nodes/LexicalParagraphNode.ts
append
called by 1105
packages/lexical/src/nodes/LexicalElementNode.ts
read
called by 1069
packages/lexical/src/LexicalEditor.ts
$getRoot
called by 875
packages/lexical/src/LexicalUtils.ts

Shape

Function 3,746
Method 1,598
Class 1,140
Interface 302
Enum 1

Languages

TypeScript100%
Python1%

Modules by API surface

flow-typed/environments/bom.js320 symbols
flow-typed/environments/html.js204 symbols
packages/lexical/src/LexicalUtils.ts174 symbols
flow-typed/environments/dom.js153 symbols
packages/lexical/src/LexicalSelection.ts131 symbols
packages/lexical-playground/__tests__/utils/index.mjs99 symbols
packages/lexical/src/caret/LexicalCaret.ts94 symbols
packages/lexical/src/__tests__/utils/index.tsx89 symbols
packages/lexical/src/nodes/LexicalElementNode.ts69 symbols
packages/lexical/src/LexicalNode.ts68 symbols
packages/lexical/src/nodes/LexicalTextNode.ts66 symbols
packages/lexical-link/src/LexicalLinkNode.ts65 symbols

Dependencies from manifests, versioned

@ark-ui/react>=5.6.0 <5.37.1 || > · 1×
@astrojs/check0.9.9 · 1×
@astrojs/react5.0.5 · 1×
@atlaskit/drag-and-drop-indicator0.11.1 · 1×
@babel/core7.29.7 · 1×
@babel/helper-module-imports7.29.7 · 1×
@babel/plugin-transform-flow-strip-types7.29.7 · 1×
@babel/plugin-transform-optional-catch-binding7.29.7 · 1×
@babel/preset-env7.29.7 · 1×
@babel/preset-flow7.29.7 · 1×
@babel/preset-react7.29.7 · 1×

For agents

$ claude mcp add lexical \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact