Switch Node

Switches are visual toggles that can be switched on or off.

Switches are often useful for boolean configuration options. They are very similar to checkboxes.

Properties

Visible

PropswitchNode.isVisible
Typeboolean
Default{{true}}

Whether or not this node is visible.

Enabled

PropswitchNode.isEnabled
Typeboolean
Default{{true}}

Whether or not this node is enabled.

Tooltip

PropswitchNode.tooltip
Typestring
Defaultundefined

The tooltip text to display when hovered or focused over this node.

Top

PropswitchNode.top
Typestring
Default1

The position of the node from the top side of the grid (grid-row-start).

Left

PropswitchNode.left
Typestring
Default1

The position of the node from the left side of the grid (grid-column-start).

Width

PropswitchNode.width
Typestring
Default128px

The width of the node. When this node is in a grid layout, this should be done using unitless grid column units (specifying 4 will become grid-column-end: span 4). When this node is in a stack layout, the width must be specified using CSS units (e.g. 100px or 100%).

Min Width

PropswitchNode.minWidth
Typestring
Defaultnone

The minimum width of the node. When this node is in a grid layout, this property is ignored.

Max Width

PropswitchNode.maxWidth
Typestring
Defaultnone

The maximum width of the node. When this node is in a grid layout, this property is ignored.

Height

PropswitchNode.height
Typestring
Default32px

The height of the node. When this node is in a grid layout, this should be done using unitless grid row units (specifying 4 will become grid-row-end: span 4). When this node is in a stack layout, the height must be specified using CSS units (e.g. 100px or 100%).

Min Height

PropswitchNode.minHeight
Typestring
Defaultnone

The minimum height of the node. When this node is in a grid layout, this property is ignored.

Max Height

PropswitchNode.maxHeight
Typestring
Defaultnone

The minimum height of the node. When this node is in a grid layout, this property is ignored.

Overflow

PropswitchNode.overflow
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the horizontal and vertical axes for content that is larger than its container.

Overflow X

PropswitchNode.overflowX
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the horizontal axis for content that is larger than its container.

Overflow Y

PropswitchNode.overflowY
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the vertical axis for content that is larger than its container.

Custom Styles

PropswitchNode.styles
Typestring
Defaultelement.styles { }

Custom CSS styles to be applied to the node. Use element.styles to refer to the current node.

Label

PropswitchNode.label
Typestring
DefaultOn or off?

The label displayed next to the switch.

Field Name

PropswitchNode.formFieldName
Typestring
Defaultundefined

Defines the key for this input in the body of the submitted form.

Label Style

PropswitchNode.labelStyle
TypeSwitchLabelStyle ('left' | 'top' | 'hidden' | 'right')
Defaultright

The display style of the label next to the switch.

Size

PropswitchNode.size
TypeCheckboxSize ('sm' | 'md' | 'lg')
Defaultmd

The size of the switch. Size is a measurement value like "md" and can be configured in the theme.

Value

PropswitchNode.value
Typeboolean
Default{{false}}

The current value of the checkbox. If switched on, this will be true. If switched off, this will be false.

Required

PropswitchNode.isRequired
Typeboolean
Default{{false}}

Whether or not this switch must be on. This is a visual flag that updates the corresponding accessibility properties. It is up to the app developer to enforce the requirement.

Event Handlers

On Checked

HandlerswitchNode.onChecked

Called when the switch is switched on.

On Unchecked

HandlerswitchNode.onUnchecked

Called when the switch is switched off.