Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Toggle

A labelled boolean switch.

Import

from manywidgets import Toggle

Example

from manywidgets import Toggle

Toggle(label="Show legend", value=True)

API

TraitTypeDefaultDescription
valueBoolFalseOn/off state.
labelUnicode''Label shown next to the switch.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).

Linking

Link like any widget (see the linking guide):

from ipywidgets import jsdlink
from manywidgets import Chart, Toggle

chart = Chart()
legend = Toggle(label="Legend", value=True)
jsdlink((legend, "value"), (chart, "legend_enabled"))