Veil UI
Components

Rich Text Editor

A lightweight content-editable editor with bold, italic and underline controls.

Installation

$ npx veil-ui@latest add rich-text-editor

Usage

import { RichTextEditor } from "@/components/ui/rich-text-editor";

<RichTextEditor defaultValue="<p>Hello</p>" onChange={setHtml} />;

Examples

Basic

Disabled

API reference

  • RichTextEditor re-exports the RichText component and its props under an editor name.
  • defaultValue is the initial HTML, onChange emits sanitised HTML on input.
  • placeholder and disabled configure the editable surface; formatting buttons apply bold, italic and underline.

Accessibility

  • The editable area is labelled and exposes aria-multiline.
  • Formatting buttons report their pressed state with aria-pressed.
  • Output is sanitised against an allowlist before it reaches the DOM.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add rich-text-editor --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { RichText } from "@/components/ui/rich-text";
import type { RichTextProps } from "@/components/ui/rich-text";

defineProps<RichTextProps & { class?: string }>();
</script>

<template>
  <RichText v-bind="$props">
    <slot />
  </RichText>
</template>

On this page