Class: ToggleView

ToggleView()

A configurable two-option toggle with optional description area. Uses the "button group" or "segmented control" UI pattern, which indicates mutually exclusive options more clearly than switch toggles or radio buttons.

Screenshot

Constructor

new ToggleView()

Since:
  • 2.34.0
Source:

Extends

  • Backbone.View

Members

className

Source:

Methods

events()

Source:

initialize(options)

Parameters:
Name Type Description
options object Configuration options
Properties
Name Type Attributes Description
options Array.<ToggleOption> Array of exactly two options
selected string The value of the initially selected option
showDescription boolean <optional>
Whether to show description below toggle. True by default.
Source:

onToggle(e)

Handles toggle option click
Parameters:
Name Type Description
e MouseEvent Click event
Source:

render() → {ToggleView}

Render the toggle UI
Source:
Returns:
This view instance
Type
ToggleView

updateButtonsAndDescription(selectedValue)

Updates the toggle buttons' active state and icons
Parameters:
Name Type Description
selectedValue string The value of the currently selected option
Source: