Getting Started
Prerequisites
Lexical uses pnpm as its package manager. Install it if you haven’t already:Development Setup
- Fork the repository on GitHub
-
Clone your fork:
-
Install dependencies:
-
Start the development server:
This starts both the playground dev server and collab server at http://localhost:3000
Making Changes
Pull Request Process
-
Create a branch from
main: - Make your changes following our coding standards
- Add tests if you’ve added code that should be tested
- Update documentation if you’ve changed APIs
-
Ensure the test suite passes:
-
Make sure your code lints:
- Commit your changes with a clear commit message
- Push to your fork and submit a pull request
Running Tests
Unit Tests
End-to-End Tests
Code Quality
Before submitting, run all checks:Contributor License Agreement (CLA)
Before we can accept your pull request, you need to submit a CLA. You only need to do this once for any Meta open source project. Complete your CLA here: https://code.facebook.com/claDocumentation Contributions
To work on the documentation website:packages/lexical-website/.
Reporting Issues
Bug Reports
When reporting bugs, please include:- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Lexical version
- Browser/environment details
- Minimal reproduction example (CodeSandbox, StackBlitz, etc.)
Use GitHub Issues to track public bugs.
Security Issues
Meta has a bounty program for security bugs. Please go through that process instead of filing a public issue.Development Workflow
Build Commands
Project Structure
Lexical is a monorepo with packages inpackages/:
lexical- Core framework@lexical/react- React bindings@lexical/rich-text- Rich text features@lexical/plain-text- Plain text features@lexical/list- List nodes@lexical/table- Table support@lexical/markdown- Markdown support@lexical/history- Undo/redo@lexical/yjs- Collaboration via Yjs- And many more…
Type Systems
Coding Guidelines
General Principles
- Write clear, self-documenting code
- Add comments for complex logic
- Follow existing code style
- Keep changes focused and atomic
- Write tests for new features
- Update documentation for API changes
$ Function Convention
Functions prefixed with$ (e.g., $getRoot(), $getSelection()) can only be called within:
editor.update(() => {...})- for mutationseditor.read(() => {...})- for read-only access- Node transforms and command handlers
Custom Nodes
When creating custom nodes:- Extend a base class (
TextNode,ElementNode,DecoratorNode) - Implement required static methods:
getType(),clone(),importJSON() - Implement instance methods:
createDOM(),updateDOM(),exportJSON() - Register with editor config:
nodes: [YourCustomNode] - Export a
$createYourNode()factory function
Community
Discord
Join our Discord for questions and discussions
Follow @lexicaljs for updates and announcements
GitHub Issues
Report bugs and request features
GitHub Discussions
Ask questions and share ideas