OptionalcontentThe DOM element that will hold the editable content element
The Tiptap editor instance
The DOM element to make resizable (e.g., an img, video, or iframe element)
Function that returns the current position of the node in the document
The ProseMirror node instance
Callback fired once when resize completes with final dimensions. Use this to persist the new size to the node's attributes.
Final width in pixels
Final height in pixels
OptionalonCallback fired continuously during resize with current dimensions. Use this to update the element's visual size in real-time.
Current width in pixels
Current height in pixels
Callback for handling node updates.
Return true to accept the update, false to reject it.
OptionaloptionsOptional configuration for resize behavior and styling
OptionalclassName?: { container?: string; handle?: string; resizing?: string; wrapper?: string }Custom CSS class names for styling
Optionalcontainer?: stringClass for the outer container element
Optionalhandle?: stringClass applied to all resize handles
Optionalresizing?: stringClass added to container while actively resizing
Optionalwrapper?: stringClass for the wrapper element that contains the resizable element
OptionalcreateCustomHandle?: (direction: ResizableNodeViewDirection) => HTMLElementOptional callback for creating custom resize handle elements.
This function allows developers to define their own handle element (e.g., custom icons, classes, or styles) for a given resize direction. It is called internally for each handle direction.
createCustomHandle: (direction) => {
const handle = document.createElement('div')
handle.dataset.resizeHandle = direction
handle.style.position = 'absolute'
handle.className = 'tiptap-custom-handle'
const isTop = direction.includes('top')
const isBottom = direction.includes('bottom')
const isLeft = direction.includes('left')
const isRight = direction.includes('right')
if (isTop) handle.style.top = '0'
if (isBottom) handle.style.bottom = '0'
if (isLeft) handle.style.left = '0'
if (isRight) handle.style.right = '0'
// Edge handles span the full width or height
if (direction === 'top' || direction === 'bottom') {
handle.style.left = '0'
handle.style.right = '0'
}
if (direction === 'left' || direction === 'right') {
handle.style.top = '0'
handle.style.bottom = '0'
}
return handle
}
Optionaldirections?: ResizableNodeViewDirection[]Which resize handles to display.
Optionalmax?: Partial<ResizableNodeDimensions>Maximum dimensions in pixels
Optionalmin?: Partial<ResizableNodeDimensions>Minimum dimensions in pixels
OptionalpreserveAspectRatio?: booleanAlways preserve aspect ratio when resizing.
When false, aspect ratio is preserved only when Shift key is pressed.
Configuration options for creating a ResizableNodeView
Example