---
title: "Using the TinyMCE package with the Svelte framework"
description: "A guide on integrating the TinyMCE package into the Svelte framework."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/svelte-pm/"
md_url: "https://www.tiny.cloud/docs/tinymce/latest/svelte-pm/index.md"
version: "latest"
last_updated: "2025-12-10T03:38:03Z"
tokens: 805
---
# Using the TinyMCE package with the Svelte framework

The [Official TinyMCE Svelte component](https://github.com/tinymce/tinymce-svelte) integrates TinyMCE into [Svelte applications](https://svelte.dev/).
Creates a basic Svelte application containing a TinyMCE editor.

For examples of the TinyMCE integration, visit the [tinymce-svelte storybook](https://tinymce.github.io/tinymce-svelte/).

## Prerequisites

Requires [Node.js (and npm)](https://nodejs.org/).

## Procedure

1. Use the [Vite](https://github.com/vitejs/vite) package to create a new Svelte project named `tinymce-svelte-demo`, such as:

```sh
npm create vite@6 tinymce-svelte-demo -- --template svelte
```
2. Change to the project directory.

```sh
cd tinymce-svelte-demo
```
3. Install project dependencies.

```sh
npm install
```
4. Install the `tinymce` and `tinymce-svelte` packages:

```sh
npm install tinymce@^8 @tinymce/tinymce-svelte
```
5. (Optional) For premium plugins, install the `tinymce-premium` package:

```sh
npm install tinymce-premium@^8.3
```
For more information, see: [Installing premium plugins](../npm-projects/#install-premium-plugins).
6. Install the `vite-plugin-static-copy` development dependency:

```sh
npm install -D vite-plugin-static-copy
```
7. Configure `vite.config.js` to copy TinyMCE to the `public/` directory:

```js
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { viteStaticCopy } from 'vite-plugin-static-copy'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    viteStaticCopy({
      targets: [
        { src: 'node_modules/tinymce/*', dest: 'tinymce' }
      ]
    }),
    svelte()
  ],
})
```
8. Open `src/App.svelte` and replace the contents with:

```svelte
<script>
import Editor from '@tinymce/tinymce-svelte';
let conf = {
  height: 500,
  menubar: false,
  plugins: [
    'advlist', 'autolink', 'lists', 'link', 'image', 'charmap',
    'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen',
    'insertdatetime', 'media', 'table', 'preview', 'help', 'wordcount'
  ],
  toolbar: 'undo redo | blocks | ' +
    'bold italic forecolor | alignleft aligncenter ' +
    'alignright alignjustify | bullist numlist outdent indent | ' +
    'removeformat | help',
}
</script>
<main>
  <h1>Hello Tiny</h1>
  <Editor
    licenseKey='gpl'
    scriptSrc='tinymce/tinymce.min.js'
    value='<p>This is the initial content of the editor.</p>'
    {conf}
  />
</main>
```

## Run the Application

Test the application using the Node.js development server.

1. To start the development server:

```sh
npm run dev
```
2. To stop the development server, use `Ctrl+C` in the terminal or command prompt.

## Next Steps

- See the following for additional information:

  - [tinymce-svelte storybook](https://tinymce.github.io/tinymce-svelte/)
  - [TinyMCE basic setup](../basic-setup/)
  - [TinyMCE Svelte integration technical reference](../svelte-ref/)
