Skip to main content

@lexical/extension/TabIndentationExtension

Interfaces

TabIndentationConfig

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

Properties

$canIndent

$canIndent: CanIndentPredicate

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

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:139

maxIndent

maxIndent: number | null

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

Type Aliases

CanIndentPredicate

CanIndentPredicate = (node) => boolean

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

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:153

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:80

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 and $canIndent to control which elements may be indented.

Parameters

editor

LexicalEditor

maxIndent?

number | ReadonlySignal<number | null>

$canIndent?

CanIndentPredicate | ReadonlySignal<CanIndentPredicate>

Returns

A cleanup function that unregisters the handler.

() => void