Switch

(part of package 'Bootstrap Extra Components') Extends designtime/SolutionModel: JSWebComponent Extends runtime: RuntimeWebComponent

A component that represents a switch toggle.

This is a reference page; many components have detailed usage guides here.

Properties

animate

Flag indicating whether animation is enabled for the switch transitions. Type: Boolean Default Value: true


componentSize

The overall size configuration of the switch component. Type: Tagstring Default Value: "Normal"


dataProviderID

Bound data provider identifier for the switch value. Type: Dataprovider


enabled

Flag indicating whether the switch is enabled for user interaction. Type: Enabled Default Value: true


handleWidth

Width of the switch handle in pixels. Type: Tagstring Default Value: "150"


label

The label text displayed adjacent to the switch. Type: Tagstring Default Value: "Switch"


labelWidth

Width of the label in pixels. Type: Tagstring Default Value: "150"


offColor

Color used for the switch when in the "off" state. Type: Tagstring Default Value: "primary"


offText

Text displayed when the switch is in the "off" state. Type: Tagstring Default Value: "Off"


onColor

Color used for the switch when in the "on" state. Type: Tagstring Default Value: "primary"


onText

Text displayed when the switch is in the "on" state. Type: Tagstring Default Value: "On"


styleClass

CSS style classes applied to the switch component. Type: Styleclass Default Value: "switch"


tabSeq

Tab sequence order for keyboard navigation. Type: Tabseq


visible

Flag indicating whether the switch is visible. Type: Visible


Events

onActionMethodID(event)

Fired when the switch is toggled.

Parameters:

  • {JSEvent} event The event object containing details about the toggle action.


onDataChangeMethodID(oldValue,newValue,event)

Handle changed data, return false if the value should not be accepted. JSEvent.data will contain extra information about dataproviderid, its scope and the scope id (record datasource or form/global variable scope) - present since 2021.06 release

Parameters:

Returns: {Boolean}


API

requestFocus()

Request the focus to this switch.

Example:

myElement.requestFocus();


Last updated

Was this helpful?