<booleanInput>
<booleanInput>
is an Input
component that renders a checkbox. If the box is checked by the user, Doenet
stores the boolean value true
in the named <booleanInput>
.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
anchor = "…" | point | |
asToggleButton = "…" | boolean | "true" "false" |
bindValueTo = "…" | "true" "false" | |
draggable = "…" | boolean | "true" "false" |
labelIsName = "…" | boolean | "true" "false" |
positionFromAnchor = "…" | text | "upperright" "upperleft" "lowerright" "lowerleft" "top" "bottom" "left" "right" "center" |
prefill = "…" | boolean | "true" "false" |
Property | Type |
---|---|
$b.anchor | point |
$b.asToggleButton | boolean |
$b.collaborateGroups | collaborateGroups |
$b.disabled | boolean |
$b.draggable | boolean |
$b.fixed | boolean |
$b.fixLocation | boolean |
$b.hidden | boolean |
$b.label | label |
$b.labelIsName | boolean |
$b.positionFromAnchor | text |
$b.prefill | boolean |
$b.text | text |
$b.value | boolean |
$b.valueChanged | boolean |
Example: <booleanInput>
survey question
A <booleanInput>
component renders a checkbox whose value is
stored as true
if the box is checked.
Example: <booleanInput>
to show/hide graph elements
The <booleanInput>
component can be used to provide user-control over the
values of attributes that accept a boolean, such as the <graph>
attribute grid,
and the general attribute hide available to all rendered components.
Example: <booleanInput>
with a label
A <label>
child can be nested within a <booleanInput>
to create a label.
Attribute Example: prefill
The <booleanInput>
component is false initially by default.
Use the prefill
attribute set to true to reverse this behavior.
Attribute Example: asToggleButton
The asToggleButton
attribute changes the default rendering format
from a checkbox to a toggle button.
Attribute Example: labelIsName
The labelIsName
attribute can be used as a shortcut to adding a <label>
child.
Attribute Example: bindValueTo
A <booleanInput>
is used to simulate a light switch using the bindValueTo
attribute.
The behavior of the <booleanInput>
checkbox is tied to the <boolean>
that is named
onBoolean
within the bindValueTo
specification. When the user’s <textInput/>
has value ON,
the condition inside the <boolean>
becomes true, which in turn causes the <booleanInput>
to
take on the value true, and the checkbox, or “lightbulb” becomes checked.
Property Example: value
The value property of a named <booleanInput>
returns its value of true or false.
Property Example: text
The text property of a named <booleanInput>
returns the text value of true or false.
Property Example: Attributes as properties
The above listed attributes of a <booleanInput>
are also available as properties.