Editor

import { Editor } from '@hanzo/ui'

Default

An empty rich-text surface with the formatting toolbar.

export function Default() {
return <Editor placeholder="Start typing..." />
}

Controlled

The value and its updates are owned by the caller.

export function Controlled() {
return (
<YStack gap="$2">
<Editor value="<p>Edit me and watch <b>onChange</b> fire.</p>" onChange={() => {}} />
</YStack>
)
}

Read only

The surface renders content without accepting edits.

export function ReadOnly() {
return <Editor readOnly value="<p>This note is locked.</p>" />
}

Types

export type EditorCommand = 'bold' | 'italic' | 'insertUnorderedList' | 'insertOrderedList'
export interface EditorProps extends Omit<YStackProps, 'children' | 'onChange'> {
/** A controlled value; omit it and edit freely to let the surface own its HTML. */
value?: string
onChange?: (value: string) => void
placeholder?: string
readOnly?: boolean
}

Exports

Editortype EditorCommandtype EditorProps