addPane
Description
Add a pane to an existing pane.
binaryWindow.addPane(targetPaneSashId, options);
Parameters
Function parameters
| Name | Type | Description |
|---|---|---|
targetPaneSashId | string | Target pane's Sash ID that the new pane is added to. |
options | object | Options for new pane. e.g., size, position, etc. |
options details
| Name | Type | Description |
|---|---|---|
content | string | DOM Node | ReactNode1 | Content of the new pane |
id | string | Sash ID to the new pane |
position | string | Position of the new pane. One of top, right, bottom, or left |
size | number | string | Size of the new pane. e.g., 100, 0.5, "50%" |
title | string | DOM Node | ReactNode1 | Title of the new pane |
Returns
Type: Sash object
Description: Newly created Sash object.
Code snippets
Javascript
<div id="container"></div>
const binaryWindow = new BinaryWindow();
binaryWindow.mount(document.getElementById('container'));
binaryWindow.addPane('target-pane-sash-id', {
position: 'bottom',
size: 120,
content: Object.assign(document.createElement('div'), { innerHTML: 'Hello World' }),
});
React
import { useEffect, useRef } from 'react';
import { Window } from 'bwin-react';
function App() {
const windowRef = useRef(null);
useEffect(() => {
windowRef.current.addPane('target-pane-sash-id', {
position: 'bottom',
size: 120,
content: <div>Hello World</div>,
});
}, []);
return <Window ref={windowRef} />;
}