Types
Import these types from @tiptap-pro/extension-slot. Returned snapshots and collections are read-only to callers.
Editor and JSONContent come from @tiptap/core; document Node and Schema come from @tiptap/pm/model.
JsonValue
Type: null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }.
Numbers must be finite. Functions, class instances and cyclic values are invalid configuration data. Optional undefined properties are omitted.
SlotKind
Type: 'block' | 'inline'. Determines which Slot Node is used.
SlotDocument
Type: JSONContent | Node. A complete Tiptap JSON or ProseMirror document.
SlotEntry
One indexed Slot, including malformed imported entries.
Properties
id(string | null): Slot ID;nullif absent or invalid.kind(SlotKind): Block or inline.path(number[]): Child indexes from the document root. Distinguishes duplicate-ID entries.parentId(string | null): Nearest containing Slot ID;nullif none is available.depth(number): Nesting depth; top-level Slots have depth0.pos(number): Position before the Slot Node.contentFrom(number): Start position inside the Slot.contentTo(number): End position inside the Slot.config(SlotConfig | null): Parsed configuration;nullif invalid.rawConfig(JsonValue): Original configuration, including malformed JSON values.content(JSONContent[]): Current child content.text(string): Validation text projection.empty(boolean): Whether content is empty, independently of requiredness or validity.
Positions apply only to the snapshot that produced them. See measurements.
SlotSnapshot
Immutable document and index captured together.
Properties
id(string): Opaque snapshot identity.document(JSONContent): Captured document.slots(SlotEntry[]): Slots in document order, including nested fields.documentRevision(number | null): Editor document revision;nullfor standalone snapshots.contextRevision(number | null): Editor validation-context revision;nullfor standalone snapshots.
SlotIssue
Properties
code(string): Built-in orcustom.*diagnostic code.severity('error' | 'warning'): Whether the issue fails validation.category('content' | 'configuration' | 'identity' | 'unavailable'): Kind of failure.slotId(string | null): Affected ID, if available.path(number[] | null): Entry path;nullfor an absent field.message(string): Fallback display text.source('builtin' | 'validator' | 'crossField'): Check that produced the issue.validator?(string): Application validator name, when applicable.ownerId?(string): Cross-field rule owner, when applicable.ruleId?(string): Explicit cross-field rule ID, when supplied.ruleIndex?(number): Zero-based cross-field rule index.details?(Record<string, JsonValue>): Structured diagnostic data, when available.
Built-in codes
| Codes | Meaning |
|---|---|
required | Required field is empty. |
disallowedBlock, disallowedInline, disallowedText, disallowedMark, disallowedAttributes | Content does not match allowed types or attributes. |
minLength, maxLength, minChildren, maxChildren | Value is outside a configured bound. |
pattern, value | Text fails its pattern or accepted-value list. |
nestedSlot, nestedKind, maxDepth | Nested Slots violate the owner's rules. |
missingId, duplicateId, missingSlot | Field identity is missing, ambiguous or absent. |
invalidConfiguration | Configuration cannot be used. |
unknownNodeType, unknownMarkType | A configured type is absent from the schema. |
missingValidator, validatorFailed, invalidValidatorResult | An application check is unavailable. |
Use codes and details for localization. Custom messages and details must not expose concealed content in application UI.
SlotValidationEntry
Properties
slotId(string | null): Validated ID, if available.path(number[]): Entry path in the snapshot.empty(boolean): Whether the Slot is empty.status('valid' | 'invalid' | 'unavailable'): Entry outcome.issues(SlotIssue[]): Entry diagnostics.
SlotValidationResult
Properties
snapshotId(string): Validated snapshot identity.documentRevision(number | null): Captured document revision.contextRevision(number | null): Captured application-context revision.valid(boolean):trueonly with no error issues or unavailable checks.status('valid' | 'invalid' | 'unavailable'): Aggregate outcome; unavailable takes precedence.scope('document' | 'slot'): Extent of validation.entries(SlotValidationEntry[]): Validated entries.issues(SlotIssue[]): All issues, including expected fields absent from the document.
InputIssue
Properties
path(string): Location in the supplied argument.code(string): Machine-readable failure code.message(string): Diagnostic description.
SlotConfigIssue
Configuration diagnostic with the same properties as InputIssue: path (string), code (string) and message (string).
SlotInputError
Extends Error. Reports malformed API input.
Constructor
message(string): Error summary.issues?(InputIssue[]): Detailed diagnostics. Omitted: oneinvalidInputissue usingmessage.
Properties
name(string):'SlotInputError'.message(string): Error summary.issues(InputIssue[], readonly): Input diagnostics.
SlotCommandRejection
Properties
command(string): Refused command name.code('missingSlot' | 'ambiguousSlot' | 'invalidInput' | 'schemaMismatch' | 'idGenerationFailed' | 'protected' | 'overlappingTargets' | 'invalidSelection' | 'unsupportedContext'): Refusal reason.slotIds(string[]): Relevant target IDs.
See commands for input types, validation for validator types, and events for payloads.