Toggle
The basic control that represents a special button which can change its state from the pressed to the unpressed one when clicked.
Usage
{
type: "toggle",
key?: string | string[],
hidden?: boolean, // false by default
disabled?: boolean, // false by default
full?: boolean, // false by default
text?: string,
icon?: string,
offText?: string,
offIcon?: string,
value?: string | number,
css?: string,
width?: string | number | "content", // "content" by default
height?: string | number | "content", // "content" by default
padding?: string | number,
// service properties and methods
$on?: { [eventName: string]: function },
$handler?: function,
$setValue?: function,
$layout?: function
}
The control can be used both with the boolean value and the string one, if the value property is specified. The value property is needed for assigning the set value as a value of the applied property. Check the example below to get the idea.
Description
Basic properties
type- (required) the type of a control. Set it to "toggle"key- (optional) the name of the specified/modified property or the path to it in the object of a Diagram itemhidden- (optional) defines whether a control is hidden. false by defaultdisabled- (optional) defines whether a control is enabled (false) or disabled (true). false by defaultfull- (optional) defines whether the toggle will be extended to the width specified by thewidthproperty. false by defaulttext- (optional) sets a text inside the toggle. When initialized together with theoffTextproperty, the specified text will be rendered in the selected (pressed) stateoffText- (optional) sets the text that will be rendered in the unselected (unpressed) state of the toggleicon- (optional) sets the CSS class of an icon displayed inside the toggle. When initialized together with theoffIconproperty, the specified CSS classes of icons will be rendered in the selected (pressed) state of the toggleoffIcon- (optional) sets the CSS class of an icon that will be rendered in the unselected (unpressed) state of the togglevalue- (optional) specifies the value in the selected (pressed) state. If not defined, the control is used with the boolean valuecss- (optional) adds style classes to a controlwidth- (optional) the width of a control. "content" by defaultheight- (optional) the height of a control. "content" by defaultpadding- (optional) sets padding between a cell and a border of the Toggle control