Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ResizableProps

Index

Properties

children?: ReactElement<any, string | JSXElementConstructor<any>>

A simple React element(like div) or React forwardRef element(React element which passed down a ref to a DOM element)

nodeRef?: RefObject<any>

a reference to the target DOM node. use this in cases you need more flexibility in your React Tree optional. this is alternative to passing children as a prop. if passed, children prop will be ignored.

grid?: PossiblySpecifyAxis<number>

Allow resize with respect to a grid

examples:

  • grid={20} - allow resize with respect to a grid of 20px (both horizontal and vertical axis)
  • grid={{horizontal:20}} - allow resize with respect to a horizontal grid of 20px
resizeRatio?: PossiblySpecifyAxis<number>

multiple scale diff by this number examples:

  • resizeRatio={2} - double the resizing ratio
  • resizeRatio={{horizontal:2}} - double the resizing ratio only horizontally
enabledHandles?: ("top" | "left" | "bottom" | "right" | "bottomRight" | "bottomLeft" | "topRight" | "topLeft")[]

An array handles to enable

handleOptions?: Partial<handleOptionsType>

options that will be passed to all handles

handlesOptions?: { top: Partial<handleOptionsType>; left: Partial<handleOptionsType>; bottom: Partial<handleOptionsType>; right: Partial<handleOptionsType>; bottomRight: Partial<handleOptionsType>; bottomLeft: Partial<handleOptionsType>; topRight: Partial<handleOptionsType>; topLeft: Partial<handleOptionsType> }

options that will be passed to specific handles. overrides handleOptions

Type declaration

disableControl?: PossiblySpecifyAxis<boolean>

the height/width target DOM node won't be controlled when set to false, initial height/width is restored

examples:

  • disableControl={true} - will disable the control on height/width of the target DOM node
  • disableControl={{horizontal: true}} - will disable the control on height of the target DOM node
handleStyle?: CSSProperties

style that will be passed to all handles

handlesStyle?: { top: CSSProperties; left: CSSProperties; bottom: CSSProperties; right: CSSProperties; bottomRight: CSSProperties; bottomLeft: CSSProperties; topRight: CSSProperties; topLeft: CSSProperties }

style that will be passed to specific handles. overrides handleStyle

Type declaration

  • top: CSSProperties
  • left: CSSProperties
  • bottom: CSSProperties
  • right: CSSProperties
  • bottomRight: CSSProperties
  • bottomLeft: CSSProperties
  • topRight: CSSProperties
  • topLeft: CSSProperties
height?: string | number

controlled height. Note! the height won't be controlled by Resizable anymore, but by prop given from parent component

example:

  • height={100} - will set the height of the target DOM node to 100px
  • height={"100px"} - will set the height of the target DOM node to 100px
  • height={"50%"} - will set the height of the target DOM node to 50% of the parent node
  • height={30vh} - will set the height of the target DOM node to 30% percent of the viewport height
width?: string | number

controlled width. Note! the width won't be controlled by Resizable anymore, but by prop given from parent component

onResize?: OnResizeEvent | { horizontal?: OnResizeUpdate<{ width: number }>; vertical?: OnResizeUpdate<{ height: number }> }
onResizeEffect?: ((pos: { left: number; top: number; right: number; bottom: number; width: number; height: number }) => void)

Type declaration

    • (pos: { left: number; top: number; right: number; bottom: number; width: number; height: number }): void
    • a callback that is called after resize ended and the DOM element is updated

      Parameters

      • pos: { left: number; top: number; right: number; bottom: number; width: number; height: number }
        • left: number
        • top: number
        • right: number
        • bottom: number
        • width: number
        • height: number

      Returns void

ResizableRef?: RefObject<ResizableRefHandle>

an imperative ref to Resizable component. ca be used to imperatively trigger actions like height and width control reset

enableRelativeOffset?: boolean

will offset the element using style.left and style.top to make the resize feel more natural affects left and top handles Note: style.position must not be 'static' in order left and top take effect

Methods

  • onResizeEnd(prevPos: { left: number; top: number; right: number; bottom: number; width: number; height: number }): void
  • Parameters

    • prevPos: { left: number; top: number; right: number; bottom: number; width: number; height: number }
      • left: number
      • top: number
      • right: number
      • bottom: number
      • width: number
      • height: number

    Returns void

  • onResizeStart(prevPos: { left: number; top: number; right: number; bottom: number; width: number; height: number }): void
  • Parameters

    • prevPos: { left: number; top: number; right: number; bottom: number; width: number; height: number }
      • left: number
      • top: number
      • right: number
      • bottom: number
      • width: number
      • height: number

    Returns void

Generated using TypeDoc