Resizable
Installation
npm install @udecode/plate-resizable
API
useResizableState
Manages state for resizable elements.
Parameters
Returns
Current alignment setting.
Maximum width constraint.
Minimum width constraint.
Updates node width in editor state.
Updates width in local state.
Current width value.
useResizable
Provides resize behavior props and handlers for resizable elements.
Parameters
State from useResizableState.
Returns
- maxWidth: Maximum width constraint
- minWidth: Minimum width constraint
- position: 'relative'
- width: Current width
- position: 'relative'
Style props for the resizable element:
Style props for the wrapper element:
Reference to the wrapper element.
useResizeHandleState
Manages state for resize handle elements.
Parameters
Returns
Current resize direction.
Initial cursor/touch position.
Initial element size.
Whether resize direction is horizontal.
Whether resize is in progress.
Editor read-only state.
Update initial position.
Update initial size.
Update resize state.
Hover callback.
Hover end callback.
Mouse down handler.
Resize handler.
Touch start handler.
useResizeHandle
Provides handlers and props for resize handle elements.
Parameters
State from useResizeHandleState.
Returns
- onMouseDown: Mouse down event handler
- onMouseOut: Mouse out event handler
- onMouseOver: Mouse over event handler
- onTouchEnd: Touch end event handler
- onTouchMove: Touch move event handler
- onTouchStart: Touch start event handler
Whether the handle should be hidden (in read-only mode).
Props to spread on the handle element: