Skip to main content

@lexical/extension/TabIndentationExtension

Interfaces​

TabIndentationConfig​

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:194

Properties​

$canIndent​

$canIndent: CanIndentPredicate

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:201

By default, indents are set on all elements for which the ElementNode.canIndent returns true. This option allows you to set indents for specific nodes without overriding the method for others.

disabled​

disabled: boolean

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:195

maxIndent​

maxIndent: number | null

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:196

Type Aliases​

CanIndentPredicate​

CanIndentPredicate = (node) => boolean

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:69

Parameters​

node​

ElementNode

Returns​

boolean

Variables​

TabIndentationExtension​

const TabIndentationExtension: LexicalExtension<TabIndentationConfig, "@lexical/extension/TabIndentation", NamedSignalsOutput<TabIndentationConfig>, unknown>

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:209

This extension adds the ability to indent content using the tab key. Generally, we don't recommend using this plugin as it could negatively affect accessibility for keyboard users, causing focus to become trapped within the editor.

Functions​

registerTabIndentation()​

registerTabIndentation(editor, maxIndent?, $canIndent?): () => void

Defined in: packages/lexical-extension/src/TabIndentationExtension.ts:114

Registers a KEY_TAB_COMMAND handler that makes Tab and Shift+Tab indent and outdent block elements (and otherwise insert a tab). Pass maxIndent to cap the indent depth (indents below maxIndent), and $canIndent to control which elements may be indented. The maxIndent cap applies to any content, including pastes, loaded state, setEditorState and collaboration updates; deeper indents already in the document are clamped once on registration.

Parameters​

editor​

LexicalEditor

maxIndent?​

number | ReadonlySignal<number | null>

$canIndent?​

CanIndentPredicate | ReadonlySignal<CanIndentPredicate>

Returns​

A cleanup function that unregisters the handler.

() => void