# Svelte Installation

> Add the Editor42 WYSIWYG HTML editor to a Svelte 5 app with @editor42/editor42-svelte, a drop-in replacement for @tinymce/tinymce-svelte. No API key.

Source: https://editor42.com/docs/install/svelte  
Section: Installation > Integrations > Svelte  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

`@editor42/editor42-svelte` is a thin wrapper around Editor42 that makes it a Svelte 5 component. There is no account, no sign-up and no key of any kind.

## Install

```sh
npm install @editor42/editor42-svelte
```

or for Yarn users:

```sh
yarn add @editor42/editor42-svelte
```

Svelte 5 is required — the component is written with runes.

## Basic Setup

```html
<script>
  import Editor from '@editor42/editor42-svelte';
</script>

<Editor conf={{ height: 400 }} value="<p>Hello from Editor42</p>" />
```

With no extra props the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever.

## Reading and Writing the Content

`value` is bindable, so the content travels both ways:

```html
<script>
  import Editor from '@editor42/editor42-svelte';

  let content = $state('<p>Hello from Editor42</p>');
</script>

<Editor bind:value={content} conf={{ height: 400, plugins: 'lists link' }} />
```

## Self-Hosting

Point the component at your own copy of the script, using the full file URL:

```html
<Editor scriptSrc="/js/editor42/editor42.min.js" />
```

## Pinning a Version

```html
<Editor channel="42.0.1" />
```

`channel` accepts `latest`, a `latest-N` alias, or an exact version.

## Editor Options

Everything else is an Editor42 option, passed through `conf`:

```html
<Editor conf={{ height: 400, menubar: false, plugins: 'lists link' }} />
```

See the [Configuration Options](https://editor42.com/api/configuration) for the full list.

## Migrating from @tinymce/tinymce-svelte

```sh
npm uninstall @tinymce/tinymce-svelte
npm install @editor42/editor42-svelte
```

Change the import to `@editor42/editor42-svelte` and you are done. `scriptSrc`, `channel` and `conf` keep their names, and TinyMCE-style numeric channels resolve to `latest`.

All API-key and licence-key handling has been removed. The corresponding props are still accepted so existing code compiles, but they do nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud.

The wrapper div class defaults to `editor42-wrapper` (it was `tinymce-wrapper`); set the `cssClass` prop if your styles target the old name.

The component also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible.

See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move.

## Live Demo

See it running, with its full source: the [Svelte demo](https://editor42.com/examples/svelte).

## Links

- NPM: [`@editor42/editor42-svelte`](https://www.npmjs.com/package/@editor42/editor42-svelte)
- GitHub: [editor42com/editor42-svelte](https://github.com/editor42com/editor42-svelte)
