Skip to main content
Version: 1.7.6

Gridview

Introduction

GridviewReact Component

import { ReactGridview } from 'dockview';
PropertyTypeOptionalDefaultDescription
onReady(event: SplitviewReadyEvent) => voidNo
componentsobjectNo
orientationOrientationYesOrientation.HORIZONTAL
proportionalLayoutbooleanYestrueSee Proportional layout
hideBordersbooleanYesfalse
classNamestringYes''
disableAutoResizingbooleanYesfalseSee Auto Resizing

Gridview API

const MyComponent = (props: IGridviewPanelProps<{ title: string }>) => {
// props.containerApi...

return <div>{`My first panel has the title: ${props.params.title}`}</div>;
};
const onReady = (event: GridviewReadyEvent) => {
// event.api...
};
PropertyTypeDescription
heightnumberComponent pixel height
widthnumberComponent pixel width
minimumHeightnumber
maximumHeightnumber
maximumWidthnumber
maximumWidthnumber
lengthnumberNumber of panels
panelsISplitviewPanel[]all panels
orientationOrientation
onDidLayoutChangeEvent<void>Fires on layout change
onDidLayoutFromJSONEvent<void>Fires of layout change caused by a fromJSON deserialization call
onDidAddPanelEvent<IGridviewPanel>Fires when a view is added
onDidRemovePanelEvent<IGridviewPanel>Fires when a view is removed
onDidActivePanelChangeEvent<IGridviewPanel \| undefined>Fires when the active group changes
addPaneladdPanel(options: AddComponentOptions): IGridviewPanel
removePanel(panel: IGridviewPanel, sizing?: Sizing): void
movePanel(panel: IGridviewPanel, options: {direction: Direction, refernece:string, size?: number}): void
getPanel(id: string) \| IGridviewPanel \| undefined
updateOptions(options:SplitviewComponentUpdateOptions): void
focus(): voidFocus the active panel, if exists
layout(width: number, height:number): voidAuto Resizing
fromJSON(data: SerializedGridview): voidSerialization
toJSON(): SerializedGridviewSerialization
clear(): voidClears the current layout

Gridview Panel API

const MyComponent = (props: IGridviewPanelProps<{ title: string }>) => {
// props.api...

return <div>{`My first panel has the title: ${props.params.title}`}</div>;
};
PropertyTypeDescription
idstringPanel id
isFocusedbooleanIs panel focsed
isActivebooleanIs panel active
isVisiblebooleanIs panel visible
widthnumberPanel width
heightnumberPanel height
onDidDimensionsChangeEvent<PanelDimensionChangeEvent>
onDidFocusChangeEvent<FocusEvent>
onDidVisibilityChangeEvent<VisibilityEvent>
onDidActiveChangeEvent<ActiveEvent>
onDidConstraintsChangeonDidConstraintsChange: Event<PanelConstraintChangeEvent>
setVisible(isVisible: boolean): void
setActive(): void
setConstraints(value: PanelConstraintChangeEvent2): void;
setSize(event: SizeEvent): void

Events

GridviewReact exposes a number of events that the developer can listen to and below is a simple example with a log panel showing those events that occur.