Splitter Panel

The left and right columns with customizable widths that can be dragged.


General


Left
Right
Show Code
import React from "react";
import SplitterPanel from 'funda-ui/SplitterPanel';
 
// component styles
import 'funda-ui/SplitterPanel/index.css';
 
 
export default () => {
 
    return (
        <>
            <SplitterPanel
                initialWidth={250}
                onDrag={(type: 'dragStart' | 'dragEnd' | 'drag', leftWidth: number) => {
                    if (type === 'dragStart') {
                        console.log('dragStart:', leftWidth);
                    } else if (type === 'drag') {
                        console.log('dragMove:', leftWidth);
                    } else if (type === 'dragEnd') {
                        console.log('dragEnd:', leftWidth);
                    }
                }}
            >
                <SplitterPanel.Left>
                    <div style={{background: 'rgba(0,0,0,.01)', height: '300px'}}>Left</div>
                </SplitterPanel.Left>
                <SplitterPanel.Right>
                    <div style={{background: 'rgba(0,0,0,.01)', height: '300px'}}>Right</div>
                </SplitterPanel.Right>
            </SplitterPanel>
 
        </>
    );
}

API

Splitter Panel

import SplitterPanel from 'funda-ui/SplitterPanel';
PropertyTypeDefaultDescriptionRequired
wrapperClassNamestring-The class name of the control wrapper.-
draggablebooleantrueWhether the divider is draggable to resize the panels.-
initialWidthnumber200The initial width (in pixels) of the left panel.-
minWidthnumber100The minimum width (in pixels) of the left panel.-
maxWidthnumberwindow.innerWidth / 2The maximum width (in pixels) of the left panel.-
onDrag(type: 'dragStart' | 'dragEnd' | 'drag', leftWidth: number) => void-Callback triggered during divider drag events. type indicates the drag phase, leftWidth is the current left panel width. For example: onDrag={(type:'dragStart'|'dragEnd'|'drag',leftWidth:number)=>{if(type==='dragStart'){console.log('dragStart:',leftWidth);}else if(type==='drag'){console.log('dragMove:',leftWidth);}else if(type==='dragEnd'){console.log('dragEnd:',leftWidth);}}}.-
childrenReact.ReactNode-Use SplitterPanel.Left and SplitterPanel.Right as children to provide content for each panel.-

Subcomponents

PropertyTypeDefaultDescriptionRequired
SplitterPanel.LeftReact.ReactNode-Container for the left panel content.
SplitterPanel.RightReact.ReactNode-Container for the right panel content.