Zephora UI

Other

Editor

Minimal dependency-free rich text editor built on contentEditable, with a formatting toolbar (bold, italic, headings, lists, blockquote, code) and controlled or uncontrolled HTML value.

Import

import { Editor } from "@zephora/react";

Examples

Uncontrolled

Hello Zephora!

Controlled

`onValueChange` receives the current HTML after every edit.

Type here…

<p>Type here…</p>

Read only

`readOnly` disables editing and the toolbar.

Release notes

This content cannot be edited.

API

Editor props

PropTypeDefaultDescription
valuestringControlled HTML value.
defaultValuestringInitial HTML for uncontrolled usage.
onValueChange(html: string) => voidCalled with the current HTML after every edit.
placeholderstringHint shown while the editor is empty.
readOnlybooleanfalseDisables editing and the toolbar.
minHeightnumber160Minimum block size of the editing area in px.
aria-labelstring"Rich text editor"Accessible name of the editing area.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

Keyboard

KeyAction
ArrowRight / ArrowLeftMoves focus between toolbar buttons (wraps around).
Enter / SpaceApplies the focused toolbar command.
TabMoves between the toolbar and the editing area.