Slate Component
Slate(props: SlateProps): JSX.Element
Slate(props: SlateProps): JSX.ElementThe Slate component must include somewhere in its children the Editable component.
Props
type SlateProps = {
editor: ReactEditor
value: Descendant[]
children: React.ReactNode
onChange?: (value: Descendant[]) => void
onSelectionChange?: (selection: Selection) => void
onValueChange?: (value: Descendant[]) => void
}props.editor: ReactEditor
props.editor: ReactEditorAn instance of ReactEditor
props.value: Descendant[]
props.value: Descendant[]The initial value of the Editor.
This prop is deceptively named.
Slate once was a controlled component (i.e. it's contents were strictly controlled by the value prop) but due to features like its edit history which would be corrupted by direct editing of the value it is no longer a controlled component.
props.children: React.ReactNode
props.children: React.ReactNodeThe children which must contain an Editable component.
props.onChange: (value: Descendant[]) => void
props.onChange: (value: Descendant[]) => voidAn optional callback function which you can use to be notified of changes in the editor's value.
props.onValueChange?: (value: Descendant[]) => void
props.onValueChange?: (value: Descendant[]) => voidprops.onChange alias.
props.onSelectionChange?: (selection: Selection) => void
props.onSelectionChange?: (selection: Selection) => voidAn optional callback function which you can use to be notified of changes of the editor's selection.
Last updated