Rich text — dir/ui
A document editor for formatted text, lists, tables, and references.
# Rich text
A document editor for formatted text, lists, tables, and references.
## Install
```sh
npx shadcn@4.21.0 add lr-run/dir-ui/rich-text#v0.1.2
```
[Registry item with source and dependencies](https://github.com/lr-run/dir-ui/blob/v0.1.2/registry.json)
Requires React 19, Tailwind CSS 4 and shadcn initialized with Base UI. Registry target placeholders resolve through components.json: @ui, @components, @hooks and @lib. Imports below use the conventional @/ prefix for illustration; the CLI rewrites them to your configured aliases. Shared components are installed once through registryDependencies. Theme CSS is imported by the UI modules. Existing files are never forcibly overwritten; review CLI conflicts before accepting changes. No Dir runtime is required.
## RichText, type RichTextValue
```tsx
import { RichText, type RichTextValue } from '@/components/ui/rich-text.tsx'
```
| Prop | Type | Default / required | Notes |
| --- | --- | --- | --- |
| label | string | Required | |
| initialContent | Note | — | |
| initialText | string | '' | |
| onUpdate | (value: RichTextValue) => void | — | |
| disabled | boolean | false | |
| references | { kind: string; id: string; title: string }[] | [] | |
| className | string | '' | |
```ts
type RichTextValue = { notesDoc: Note; notes: string }
```
An uncontrolled editor that accepts initial content. Change its key to load another document or reset it externally. The caller owns persistence.