# About Yurich {#overview}

Source: [How the Yurich React editor works · Yurich](https://leeyujoo.com/yurich/overview/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

Yurich is a React rich text editor for posts, comments, and forms. Decide what people can format, build the toolbar in your app, and save the result as HTML.

## Build the toolbar your screen needs {#highlights}

In a React 18+ app, run `npm install yurich`. Yurich uses the `react` and `react-dom` packages already installed in your project. It brings in zero extra runtime libraries.

For a comment box, start with bold and links. Register `Bold` and `Link` and connect them to your buttons. Yurich supplies the editing behavior, while your app supplies the controls and styles. [Try the bold button](https://leeyujoo.com/yurich/features/bold/)

## What happens to the text you edit? {#core}

### Save the same HTML you edit

The editable area is a browser element with `contentEditable`. The browser edits its HTML directly, and Yurich reads the highlighted text through the Selection API to apply formatting. This editable HTML is the document. `getHTML()` reads it when you submit the form. There is no second model to keep in sync, and formatting commands work directly on the DOM, without `document.execCommand`. [Try saving HTML](https://leeyujoo.com/yurich/#submit-html)

### Choose what survives a paste

Enabled extensions define the permitted HTML. With only `Bold` enabled, a pasted heading becomes a paragraph and bold text stays bold. The same rules apply when loading a draft and when exporting HTML with sanitization enabled. [Try pasting formatted text](https://leeyujoo.com/yurich/features/clipboard/)

### Support keyboards and text composition

The editor exposes an accessible multiline textbox and runs extension keyboard shortcuts. Use `ariaLabel` to name the field and `aria-pressed` on toolbar toggles. During Japanese, Korean, Chinese, or other IME composition, Yurich waits for composition to finish before cleaning up the edited block. [See IME behavior](https://leeyujoo.com/yurich/features/ime/)

## What the bold button does {#architecture}

Register `Bold` to enable `toggleBold` and allow `<strong>` in the document.

1. **React app** The toolbar calls `toggleBold`.
2. **Yurich core** The command reads the selection and applies the formatting.
3. **Editable HTML** The selected text is wrapped in `<strong>`.

| Before | After |
| --- | --- |
| `<p>Hello Yurich</p>` | `<p>Hello <strong>Yurich</strong></p>` |

Yurich records the edit and selection in history. A toolbar button can use `useIsActive` to tell whether the selection is bold.

## Two ways to use it {#design}

### Article form

Register `Bold` and `Link` for the article body. Call `getHTML()` on submit and send it with the other fields to your API. [Try the form example](https://leeyujoo.com/yurich/#submit-html).

### Internal publishing tool

If editors need a callout, declare an `aside` block with `block()`. Connect its command to a toolbar button so the callout survives when the document is saved and reopened. [Build a custom extension](https://leeyujoo.com/yurich/extensions/block/).

## Where it fits {#fit}

Yurich works in browser-based forms, comment editors, and publishing tools with a custom interface. Editing needs a mounted DOM. Your app handles storage and synchronization.

[Browse the API](https://leeyujoo.com/yurich/api/)
