JGuang

ResizeBox

ResizeBox · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

ResizeBox

ResizeBox components.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: Basic usage of ResizeBox. By setting directions, you can specify which of the four sides can be stretched.
  • Customize Trigger: The content of trigger in all directions can be customized through the property resizeTriggers.
  • Controlled Size: The height and width of the ResizeBox can be controlled, corresponding to the attributes width and height, and the height and width values during dragging can be obtained through onChange.
  • Use in Layout: The ResizeBox component is integrated in the Layout component, so a scalable sidebar can be used in the layout.
  • Panel Split: Divide a panel into two parts with adjustable width or height. Use direction to control the direction of the split.
  • Panel Split Nesting: Panel split can be nested.
  • Panel Split Group: Multiple panels can be split through SplitGroup, and it also supports quick collapse and manual drag;

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

ResizeBox

PropertyDescriptionTypeDefaultValueVersion
heightThe height of ResizeBoxnumber-2.7.0
widthThe width of ResizeBoxnumber-2.7.0
componentThe html tag of ResizeBoxstringdiv-
directionsThe edges can be Resize, It can be up, down, left, rightArray<'left' | 'right' | 'top' | 'bottom'>['right']-
classNameAdditional css classstring | string[]--
resizeIconsCustom the icon of Split,All four directions are supported{top?: ReactNode;bottom?: ReactNode;left?: ReactNode;right?: ReactNode;}{}-
resizeTriggersCustom the content of Split,All four directions are supported{top?: ReactNode;bottom?: ReactNode;left?: ReactNode;right?: ReactNode;}{}-
styleAdditional styleCSSProperties--
onMovingCallback when resizing(e: MouseEvent, size: { width: number; height: number }) => void-size in 2.7.0
onMovingEndCallback when the end of resize() => void--
onMovingStartCallback when the start of resize.() => void--

ResizeBox.Split

PropertyDescriptionTypeDefaultValueVersion
disabledWhether the split is disabledboolean--
componentThe html tag of Splitstringdiv-
directionThe direction of Split. It can be horizontal and vertical'horizontal' | 'vertical' | 'horizontal-reverse' | 'vertical-reverse'horizontalreverse in 2.35.0
iconCustom the icon of SplitReactNode--
triggerCustom the content of SplitReactNode--
classNameAdditional css classstring | string[]--
maxMaximum thresholdnumber | string--
minMinimum thresholdnumber | string--
panespanes,[firstPane, secondPane]ReactNode[] (Required)--
sizeSplit size. It can be 0~1 representing a percentage, or a specific number of pixels, ex 300pxnumber | string0.5-
styleAdditional styleCSSProperties--
onMovingCallback when moving(e: MouseEvent, size: number | string) => void-size in 2.14.0
onMovingEndCallback when the end of resize() => void--
onMovingStartCallback when the start of resize() => void--
onPaneResizeCallback when pane resized(paneContainers: HTMLElement[]) => void-2.25.0

ResizeBox.SplitGroup in 2.27.0

PropertyDescriptionTypeDefaultValue
componentThe html tag of SplitGroupstringdiv
directionThe direction of Split. It can be horizontal and vertical'horizontal' | 'vertical'horizontal
iconCustom the icon of SplitReactNode-
classNameAdditional css classstring | string[]-
panespanesSplitGroupPane[] (Required)-
styleAdditional styleCSSProperties-
onMovingCallback when moving(e: MouseEvent, size: string[], activeIndex: number) => void-
onMovingEndCallback when the end of resize(activeIndex: number) => void-
onMovingStartCallback when the start of resize(activeIndex: number) => void-
onPaneResizeCallback when pane resized(paneContainers: HTMLElement[]) => void-

ResizeBox.SplitGroup.CollapsedConfig

PropertyDescriptionTypeDefaultValue
onClickClick the callback for quick folding(e, collapsed, activeIndex, direction: 'prev' | 'next') => void-
iconQuick collapse button iconReactNode-

ResizeBox.SplitGroup.Pane

PropertyDescriptionTypeDefaultValue
disableddisabled, the split bar will not be displayedboolean-
resizableWhether to support drag and dropbooleantrue
contentThe contents of the current panelReactNode (Required)-
collapsibleWhether to support fast collapsed| boolean| {prev?: boolean | CollapsedConfig;next?: boolean | CollapsedConfig;}-
maxMinimum thresholdnumber | string-
minMaximum threshold, The priority is higher than max and will affect the threshold of adjacent panels.number | string-
sizeThe size of the segmentation can be 0~1 representing a percentage, or a pixel with a specific value, such as 300pxnumber | string-
triggerCustomize the content of the Split(prevNode: ReactNode, resizeNode: ReactNode, nextNode: ReactNode) => ReactNode-