Components
Rich Text Editor
A lightweight content-editable editor with bold, italic and underline controls.
Installation
$ npx veil-ui@latest add rich-text-editorUsage
import { RichTextEditor } from "@/components/ui/rich-text-editor";
<RichTextEditor defaultValue="<p>Hello</p>" onChange={setHtml} />;Examples
Basic
Disabled
API reference
RichTextEditorre-exports theRichTextcomponent and its props under an editor name.defaultValueis the initial HTML,onChangeemits sanitised HTML on input.placeholderanddisabledconfigure 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>