takes the setting to be the dynamically updated current value of x, with the value of x being toggled if the checkbox is clicked.
Checkbox[x,{val1,val2}]
represents a checkbox that toggles between values val1 and val2 and displays as
and
, respectively.
Checkbox[x,{val1,val2,val3,…}]
represents a checkbox that cycles through values vali and displays as
for all vali with i>2.
Checkbox
takes the setting to be the dynamically updated current value of x, with the value of x being toggled if the checkbox is clicked.
Checkbox[x,{val1,val2}]
represents a checkbox that toggles between values val1 and val2 and displays as
and
, respectively.
Checkbox[x,{val1,val2,val3,…}]
represents a checkbox that cycles through values vali and displays as
for all vali with i>2.
Details and Options
- Checkbox is effectively a special case of Toggler.
- The following options can be given:
-
Appearance Automatic the overall appearance of the checkbox AutoAction False whether to change the checkbox automatically when the mouse is over it BaselinePosition Automatic alignment relative to surrounding text BaseStyle {} base style specifications for the checkbox Enabled Automatic whether the checkbox is enabled or grayed out ImageMargins 0 margins around the image of the displayed checkbox - Typical possible settings for Appearance include Small, Medium, and Large.
- Checkbox[] is equivalent to Checkbox[False].
Examples
open all close allBasic Examples (2)
The default states for Checkbox:
{Checkbox[False], Checkbox[True]}Using different values for states:
{Checkbox[1, {1, 2, 3}], Checkbox[2, {1, 2, 3}], Checkbox[3, {1, 2, 3}]}Scope (3)
By using Dynamic variables within Checkbox, the state variable is dynamically updated:
{Checkbox[Dynamic[x]], Dynamic[x]}Here the value of x cycles through the list {1,2,3,4}:
{Checkbox[Dynamic[x], {1, 2, 3, 4}], Dynamic[x]}Multiple checkboxes can share the same state variable:
{Checkbox[Dynamic[x], {2, 1}], Checkbox[Dynamic[x], {1, 2}], Dynamic[x]}Options (8)
Appearance (2)
AutoAction (2)
By default, the checkbox does not change state until it is clicked:
Checkbox[]By setting AutoAction, the checkbox changes state when the mouse moves over it:
Checkbox[AutoAction -> True]Values will change as the cursor is moved over the clickable area:
Checkbox[Dynamic[x], AutoAction -> True]BaselinePosition (1)
Enabled (2)
The Enabled option allows the checkbox to be changed:
{Checkbox[Dynamic[x], Enabled -> False], Checkbox[Dynamic[x], Enabled -> True]}The Enabled option can be changed dynamically for use in applications:
{Checkbox[Dynamic[x]], Checkbox[Dynamic[y], Enabled -> Dynamic[x]]}Applications (4)
Use Checkbox to set variables corresponding to a three-way light switch:
Row[{Checkbox[Dynamic[x]], Checkbox[Dynamic[y]], Checkbox[Dynamic[z]], "⟹", Dynamic[Xor[x, y, z]]}]Control options through checkboxes:
{AxesLabel -> {Checkbox[Dynamic[xlab], {"", "x"}, Enabled -> Dynamic[axes]], Checkbox[Dynamic[ylab], {"", "y"}, Enabled -> Dynamic[axes]]},
Axes -> Checkbox[Dynamic[axes], {False, True}]}Graphics[{Opacity[.5], Table[{Hue[RandomReal[]], Rectangle[RandomReal[2, 2]]}, {20}]}, AxesLabel -> {Dynamic[xlab], Dynamic[ylab]}, Axes -> Dynamic[axes]]Use checkboxes to build a dynamic truth table:
DynamicTruthTable[f_, vars_] :=
DynamicModule[{v, arr, e, tt},
(* localize *)
v = Array[arr, {Length[vars]}];
e = Function[Evaluate[f /. Thread[vars -> Array[Slot, {Length[vars]}]]]];
(* truth table *)
tt = Grid[{Append[vars, TraditionalForm[f]], Append[Map[Composition[Checkbox, Dynamic], v], Apply[Composition[Dynamic, Evaluate[e]], v]]}, Dividers -> {All, All}];
(* initialize *)
Do[arr[i] = False, {i, Length[vars]}];
tt
]DynamicTruthTable[And[Or[a, b], b, c], {a, b, c}]Count the number of clicks in a Checkbox:
DynamicModule[{x = False, changeCount = 0}, Column[{Checkbox[Dynamic[x, (x = #;changeCount++)&], {False, True}], Row[{"x is ", Dynamic[x]}], Row[{"x has been changed ", Dynamic[changeCount], " times."}]}]]See Also
Toggler Opener Setter Panel RadioButton Control CheckboxBar
Function Repository: CheckboxLegended OnOffToggle
Tech Notes
Related Workflows
- Build a Manipulate
History
Text
Wolfram Research (2007), Checkbox, Wolfram Language function, https://reference.wolfram.com/language/ref/Checkbox.html.
CMS
Wolfram Language. 2007. "Checkbox." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Checkbox.html.
APA
Wolfram Language. (2007). Checkbox. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Checkbox.html
BibTeX
@misc{reference.wolfram_2026_checkbox, author="Wolfram Research", title="{Checkbox}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Checkbox.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_checkbox, organization={Wolfram Research}, title={Checkbox}, year={2007}, url={https://reference.wolfram.com/language/ref/Checkbox.html}, note=[Accessed: 12-June-2026]}