@lexical/react/LexicalContentEditable
Type Aliases
ContentEditableElementProps
ContentEditableElementProps =
object&Omit<React.AllHTMLAttributes<HTMLDivElement>,"placeholder">
Defined in: packages/lexical-react/src/shared/LexicalContentEditableElement.tsx:48
Props for the ContentEditableElement component. In addition to an
editor, it accepts the standard <div> HTML attributes (except
placeholder), including the hyphenated aria-* attributes, which are the
preferred way to set ARIA properties. The camelCase aria* props (such as
ariaLabel) are also accepted but are retained only for backwards
compatibility.
role defaults to textbox while the editor is editable. While it is not
editable the default depends on whether the element can be named: a
non-editable editor with an aria-label/aria-labelledby is a read-only
form field and keeps textbox, while one with no accessible name renders
content rather than a widget and takes no role at all. The invariant is that
the element carries a widget role if and only if it can be named — an
unnamed widget role is an aria-input-field-name violation, and a name on a
roleless element is an aria-prohibited-attr one. Pass role explicitly to
override either default.
Widget-only ARIA (aria-autocomplete, aria-readonly, aria-multiline,
aria-required, aria-placeholder, ...) is emitted only alongside a role,
in either spelling, since those attributes are aria-allowed-attr
violations without one.
Type Declaration
ariaActiveDescendant?
optionalariaActiveDescendant?:React.AriaAttributes["aria-activedescendant"]
ariaAutoComplete?
optionalariaAutoComplete?:React.AriaAttributes["aria-autocomplete"]
ariaControls?
optionalariaControls?:React.AriaAttributes["aria-controls"]
ariaDescribedBy?
optionalariaDescribedBy?:React.AriaAttributes["aria-describedby"]
ariaErrorMessage?
optionalariaErrorMessage?:React.AriaAttributes["aria-errormessage"]
ariaExpanded?
optionalariaExpanded?:React.AriaAttributes["aria-expanded"]
ariaInvalid?
optionalariaInvalid?:React.AriaAttributes["aria-invalid"]
ariaLabel?
optionalariaLabel?:React.AriaAttributes["aria-label"]
ariaLabelledBy?
optionalariaLabelledBy?:React.AriaAttributes["aria-labelledby"]
ariaMultiline?
optionalariaMultiline?:React.AriaAttributes["aria-multiline"]
ariaOwns?
optionalariaOwns?:React.AriaAttributes["aria-owns"]
ariaRequired?
optionalariaRequired?:React.AriaAttributes["aria-required"]
autoCapitalize?
optionalautoCapitalize?:HTMLDivElement["autocapitalize"]
data-testid?
optionaldata-testid?:string|null
editor
editor:
LexicalEditor
ContentEditableProps
ContentEditableProps =
Omit<ContentEditableElementProps,"editor"> & {aria-placeholder?:void;placeholder?:null; } | {aria-placeholder:string;placeholder: ((isEditable) =>null|JSX.Element) |JSX.Element; }
Defined in: packages/lexical-react/src/LexicalContentEditable.tsx:29
Props for the ContentEditable component. These are the
ContentEditableElementProps (minus editor, which is read from
context) plus an optional placeholder; when a placeholder is provided an
aria-placeholder string is also required for accessibility.
Variables
ContentEditable
constContentEditable:ForwardRefExoticComponent<ContentEditableProps&RefAttributes<HTMLDivElement>>
Defined in: packages/lexical-react/src/LexicalContentEditable.tsx:53
The editable surface of a Lexical editor: the contentEditable element that
users type into. Render it inside a LexicalComposer (it reads the
editor from context) and pass it to RichTextPlugin or
PlainTextPlugin. An optional placeholder is shown while the editor
is empty. The ref is forwarded to the underlying <div>.
ContentEditableElement
constContentEditableElement:ForwardRefExoticComponent<object&Omit<AllHTMLAttributes<HTMLDivElement>,"placeholder"> &RefAttributes<HTMLDivElement>>
Defined in: packages/lexical-react/src/shared/LexicalContentEditableElement.tsx:210
A lower-level building block for the editor's editable <div>. It binds the
given editor to the rendered element via
LexicalEditor.setRootElement, reflects the editor's editable state on
the contentEditable attribute, and applies the provided ARIA and HTML
attributes. Prefer ContentEditable, which reads the editor from
context and adds placeholder support, unless you need this extra control.