Skip to content

RangeDecoration

Defined in: packages/editor/src/types/editor.ts:512

A range decoration is a UI affordance that wraps a given selection range in the editor with a custom component. This can be used to highlight search results, mark validation errors on specific words, draw user presence and similar.

component: (props) => ReactElement<any>

Defined in: packages/editor/src/types/editor.ts:526

A component for rendering the range decoration. The component will receive the children (text) of the range decoration as its children.

ReactNode

ReactElement<any>

(rangeComponentProps: PropsWithChildren) => (
<SearchResultHighlight>
{rangeComponentProps.children}
</SearchResultHighlight>
)

optional onMoved: (details) => void

Defined in: packages/editor/src/types/editor.ts:534

A optional callback that will be called when the range decoration potentially moves according to user edits.

RangeDecorationOnMovedDetails

void


optional payload: Record<string, unknown>

Defined in: packages/editor/src/types/editor.ts:538

A custom payload that can be set on the range decoration


selection: EditorSelection

Defined in: packages/editor/src/types/editor.ts:530

The editor content selection range