Svelte Rich Text Editor

SvRichText is a small WYSIWYG editor over a contentEditable region. It emits HTML through bind:value, takes a configurable toolbar, and adds no third-party dependency to your bundle. It covers the formatting most applications actually need: bold, italic, underline, strikethrough, headings, lists, quotes, code blocks, alignment, links and undo.

It is deliberately not a document editor. There is no collaborative editing, no comment threads and no change tracking. For a notes field, a description box or a comment form, that is the right amount of editor.

Install

npm i @svgrid/grid

Free and MIT-licensed in @svgrid/grid: no license key, no row cap, no watermark.

The code

<script lang="ts">
  import { SvRichText } from '@svgrid/grid'

  let html = $state('<p>Hello</p>')
</script>

<SvRichText
  bind:value={html}
  placeholder="Write something..."
  minHeight="120px"
  tools={['bold', 'italic', 'underline', '|', 'ul', 'ol', '|', 'link', 'clear']}
/>

What you get

Live examples

Documentation

Related articles

Frequently asked questions

How do I add a rich text editor to a Svelte app?

Import SvRichText from @svgrid/grid and bind a string with bind:value. The editor emits HTML and needs no other package.

Can I customize the toolbar?

Yes. Pass a tools array naming the buttons you want, in order, using a pipe string for a separator.

Does it support collaborative editing?

No. It is a single-user WYSIWYG field with no collaboration, comments or change tracking, and none are planned. For a document editor, use a dedicated one.

Is it free?

Yes. SvRichText is MIT-licensed in @svgrid/grid and dependency-free.

Build something else

Get started · Browse the gallery · Pricing