widgets
The namespace provides a built-in collection of tool definitions (Widget type definitions) for the Toolbar component, which allow the user to interact with a JointJS diagram.
To learn more about the plugin, check out the Widget types section.
Classes​
The plugin provides the following classes:
button​
class button extends Widget { }
Insert a button-type input field to the Toolbar. See the Toolbar Widget button section for a demo.
Available options​
- [optional]
textis a string specifying the text inside the button.
Events​
- click
- pointerclick (click)
- pointerdown
- pointerup
checkbox​
class checkbox extends Widget { }
Insert a checkbox-type input field to the Toolbar. See the Toolbar Widget checkbox section for a demo.
Available options​
- [optional]
labelis a string specifying the label placed next to the checkbox, - [optional]
valueis a boolean specifying the initial value of the checkbox.
Events​
- change
- click
- input
- pointerclick (click)
- pointerdown
- pointerup
colorPicker​
class colorPicker extends Widget {
setValue: (value: string, opt?: { silent: boolean }) => void
}
Insert a color-type input field to the Toolbar. See the Toolbar Widget colorPicker section for a demo.
Available options​
- [optional]
valueis a string specifying the initial value of the color picker. It is#FFFFFFby default.
Events​
fullscreen​
class fullscreen extends button { }
Insert a fullscreen button into the Toolbar, which can trigger the browser's full-screen mode for a specific HTML Element. It is implemented as a button-type input field. See the Toolbar Widget fullscreen section for a demo.
Available options​
- [optional]
targetis an HTMLElement or a string selector specifying the target HTML Element to be presented in full-screen mode. It iswindow.top.document.bodyby default.
inputNumber​
class inputNumber extends Widget { }
Insert a number-type input field into the Toolbar. See the Toolbar Widget inputNumber section for a demo.
Available options​
- [optional]
labelis a string specifying the label placed next to the inputNumber, - [optional]
minandmaxare numbers specifying the minimum and maximum values of the inputNumber range, - [optional]
valueis a number specifying the initial value of the inputNumber.
Events​
inputText​
class inputText extends Widget { }
Insert a text-type input field into the Toolbar. See the Toolbar Widget inputText section for a demo.
Available options​
- [optional]
labelis a string specifying the label placed next to the inputText, - [optional]
valueis a string specifying the initial value of the inputText.
Events​
label​
class label extends Widget { }
Insert a piece of text into the Toolbar. See the Toolbar Widget label section for a demo.
Available options​
- [optional]
textis a string specifying the text of the label.
range​
class range extends Widget {
setValue: (value: number, opt?: { silent: boolean }) => void;
}
Insert a range-type input field into the Toolbar. See the Toolbar Widget range section for a demo.
Available options​
- [optional]
minandmaxare numbers specifying the minimum and maximum values of the range, - [optional]
stepis a number specifying the increment value of the range, - [optional]
unitis a string specifying the unit of the range (e.g.px, to transform user-selected15to15px), - [optional]
valueis a number specifying the initial value of the range.
Events​
redo​
class redo extends button { }
Insert a redo button into the Toolbar, which can communicate with a CommandManager instance to redo next change in the diagram. It is implemented as a button-type input field. See the Toolbar Widget redo section for a demo.
Available options​
- [optional]
autoToggleis a boolean specifying whether the button should get disabled when there are no more actions in the history to redo. It isfalseby default. The Widget type'sautoToggleproperty allows you to override the global Toolbar setting (ui.Toolbar.options.autoToggle) for a particular Toolbar Widget.
selectBox​
class selectBox extends Widget {
selectBox: SelectBox
}
Insert an instance of SelectBox into the Toolbar. See the Toolbar Widget selectBox section for a demo.
See the SelectBox documentation for details about available options.
selectButtonGroup​
class selectButtonGroup extends Widget {
selectButtonGroup: SelectButtonGroup
}
Insert an instance of SelectButtonGroup into the Toolbar. See the Toolbar Widget selectButtonGroup section for a demo.
See the SelectButtonGroup documentation for details about available options.
separator​
class separator extends Widget { }
Insert a vertical line into the Toolbar. See the Toolbar Widget separator section for a demo.
Available options​
- [optional]
widthis a number specifying the width of the space around the separator.
textarea​
class textarea extends Widget { }
Insert a textarea element into the Toolbar. See the Toolbar Widget textarea section for a demo.
Available options​
- [optional]
labelis a string specifying the label placed next to the textarea, - [optional]
valueis a string specifying the initial value of the textarea.
Events​
toggle​
class toggle extends Widget { }
Insert a toggle into the Toolbar. It is implemented as a checkbox-type input field. See the Toolbar Widget toggle section for a demo.
Available options​
- [optional]
labelis a string specifying the label placed next to the toggle, - [optional]
valueis a boolean specifying the initial value of the toggle.
Events​
- change
- click
- input
- pointerclick (click)
- pointerdown
- pointerup
undo​
class undo extends button { }
Insert an undo button into the Toolbar, which can communicate with a CommandManager instance to undo previous change in the diagram. It is implemented as a button-type input field. See the Toolbar Widget undo section for a demo.
Available options​
- [optional]
autoToggleis a boolean specifying whether the button should get disabled when there are no more actions in the history to undo. It isfalseby default. The Widget type'sautoToggleproperty allows you to override the global Toolbar setting (ui.Toolbar.options.autoToggle) for a particular Toolbar Widget.
zoomIn​
class zoomIn extends button { }
Insert a zoom-in button into the Toolbar, which can communicate with a PaperScroller instance to trigger zoom. It is implemented as a button-type input field. See the Toolbar Widget zoomIn section for a demo.
Available options​
- [optional]
autoToggleis a boolean specifying whether the button should get disabled when maximum zoom level is reached. It isfalseby default. The Widget type'sautoToggleproperty allows you to override the global Toolbar setting (ui.Toolbar.options.autoToggle) for a particular Toolbar Widget, - [optional]
minandmaxare numbers specifying the minimum and maximum values of the zoom level range. They are0.2and5by default, respectively, - [optional]
stepis a number specifying the increment value of the zoom level range. It is0.2by default.
zoomOut​
class zoomOut extends button { }
Insert a zoom-out button into the Toolbar, which can communicate with a PaperScroller instance to trigger zoom. It is implemented as a button-type input field. See the Toolbar Widget zoomOut section for a demo.
Available options​
- [optional]
autoToggleis a boolean specifying whether the button should get disabled when minimum zoom level is reached. It isfalseby default. The Widget type'sautoToggleproperty allows you to override the global Toolbar setting (ui.Toolbar.options.autoToggle) for a particular Toolbar Widget, - [optional]
minandmaxare numbers specifying the minimum and maximum values of the zoom level range. They are0.2and5by default, respectively, - [optional]
stepis a number specifying the increment value of the zoom level range. It is0.2by default.
zoomSlider​
class zoomSlider extends range { }
Insert a zoom slider into the Toolbar, which can communicate with a PaperScroller instance to trigger zoom. It is implemented as a range-type input field. See the Toolbar Widget zoomSlider section for a demo.
Available options​
- [optional]
minandmaxare numbers specifying the minimum and maximum values of the zoom slider range. They are20and500by default, respectively, - [optional]
stepis a number specifying the increment value of the zoom slider range. It is20by default, - [optional]
unitis a string specifying the unit of the zoom slider range (e.g.%, to transform user-selected20to20%). It is%by default, - [optional]
valueis a number specifying the initial value of the zoom slider range. It is100by default.
zoomToFit​
class zoomToFit extends button { }
Insert a zoom-to-fit button into the Toolbar, which can communicate with a PaperScroller instance to trigger zoom. It is implemented as a button-type input field. See the Toolbar Widget zoomToFit section for a demo.
Available options​
- [optional]
minandmaxare numbers specifying the minimum and maximum values of the zoom level range. They are0.2and5by default, respectively, - [optional]
paddingis a number specifying the minimum amount of padding around diagram content in the zoomed-to-fit viewport (in px). It is20by default, - [optional]
stepis a number specifying the increment value of the zoom level range. It is0.2by default, - [optional]
useModelGeometryis a boolean specifying whether the dimensions of diagram content should be calculated from the dimensions of Cell models (instead of CellViews). It isfalseby default. Seedia.Paper.getContentArea()for more information.
Types​
The plugin uses the following type:
WidgetMap​
interface WidgetMap {
button: button,
checkbox: checkbox,
'color-picker': colorPicker,
fullscreen: fullscreen,
'input-number': inputNumber,
'input-text': inputText,
label: label,
range: range,
redo: redo,
'select-box': selectBox,
'select-button-group': selectButtonGroup,
separator: separator,
textarea: textarea,
toggle: toggle,
undo: undo,
'zoom-in': zoomIn,
'zoom-out': zoomOut,
'zoom-slider': zoomSlider,
'zoom-to-fit': zoomToFit,
}