Getting Started
You can get started by using one of the demo projects or following the quick start to add svelte-lexical to your existing project.
Quick Start
- 
To add
svelte-lexicalto your project, run the following command:Terminal window pnpm add svelte-lexical - 
Import the
RichTextComposercomponent in your Svelte component or page:+page.svelte <script>import {RichTextComposer} from 'svelte-lexical';</script> - 
Import the default theme in your Svelte component or page:
+page.svelte <script>import {RichTextComposer} from 'svelte-lexical';import {theme} from 'svelte-lexical/dist/themes/default';</script> - 
Use the
RichTextComposercomponent in your Svelte component or page:+page.svelte <script>import {RichTextComposer} from 'svelte-lexical';import {theme} from 'svelte-lexical/dist/themes/default';</script><RichTextComposer {theme} /> - 
Add the icons used by the toolbar and dialogs in your application:
Copy the icons folder from the
svelte-lexicalpackage to your project’sstatic/imagesfolder.Your folder structure should look like this:
- svelte.config.js
 - package.json
 - src
 Directorystatic
Directoryimages
Directoryicons
- arrow-clockwise.svg
 - add-sign.svg
 - bold.svg
 - camera.svg
 - …
 
 
Use a demo project to get started
svelte-lexical has a few demo projects to cover different use cases. You can pick one of the following as your starting point:
- richtext-editor: A basic implementation using the pre-built rich text editor. (Framework: Svelte)
 - sveltekit: A custom built rich text editor and the toolbar using the default theme. (Framework: SvelteKit)
 - playground: A comprehensive demo with most of the features. (Framework: Svelte)
- Showcases most of the features of the library
 - Defines a custom UI theme for the editor and the shell
 - Includes Dev Tools for troubleshooting
 - Includes e2e tests