({{, (RefLink[CheckboxBar, paclet:ref/CheckboxBar])[x,{(Subscript[val, 1]),(Subscript[val, 2]),…}] 
represents a checkbox bar with setting x and with checkboxes for values (Subscript[val, i]) to include in the list x.}, {, (RefLink[CheckboxBar, paclet:ref/CheckboxBar])[(RefLink[Dynamic, paclet:ref/Dynamic])[x],{(Subscript[val, 1]),(Subscript[val, 2]),…}]
takes the setting to be the dynamically updated current value of x, with the values in the list x being reset every time a checkbox is clicked.}, {, (RefLink[CheckboxBar, paclet:ref/CheckboxBar])[x,{(Subscript[val, 1])->(Subscript[lbl, 1]),(Subscript[val, 2])->(Subscript[lbl, 2]),…}]
represents a checkbox bar in which the checkbox associated with value (Subscript[val, i]) has label (Subscript[lbl, i]).}})

OpenersNotesSection(Spacer1)Details and Options

Multiple checkboxes in a (RefLink[CheckboxBar, paclet:ref/CheckboxBar]) can be checked at the same time. The values associated with all checked checkboxes are given in a list. »

The (Subscript[val, i]) and (Subscript[lbl, i]) can be strings, boxes, graphics, or any other expressions, including dynamic expressions. »

In (RefLink[CheckboxBar, paclet:ref/CheckboxBar])[x,list], (RefLink[Delimiter, paclet:ref/Delimiter]) can appear as an element of list, specifying a vertical delimiter in the displayed setter bar.

The following options can be given:

Possible settings for the (RefLink[Appearance, paclet:ref/Appearance]) option include:

(RefLink[Appearance, paclet:ref/Appearance])->"Vertical"->{h,w} will display the controls in a grid with the specified number of columns and rows, vertically filling each column in turn. (RefLink[Appearance, paclet:ref/Appearance])->"Horizontal"->{h,w} horizontally fills the rows instead.

If one of h or w is (RefLink[Automatic, paclet:ref/Automatic]), it is taken to be the smallest number so that all the controls will fit in the resulting grid. If both h and w are (RefLink[Automatic, paclet:ref/Automatic]), they are calculated so the grid has roughly the same number of rows as columns.

(RefLink[Method, paclet:ref/Method])->"Active" will cause the active area for each item to include the corresponding label.

The settings for (RefLink[BaseStyle, paclet:ref/BaseStyle]) and (RefLink[LabelStyle, paclet:ref/LabelStyle]) are appended to the default styles typically given by the "CheckboxBar" and "CheckboxBarLabel" styles in the current stylesheet.

OpenersPrimaryExamplesSection(Spacer1)Examples  (17)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create checkboxes with specified states:

CheckboxBar[{1,3},{1,2,3}]

Include labels:

CheckboxBar[{1,3},{1->"One",2->"Two",3->"Three"}]

OpenersExampleSection1(Spacer1)Scope  (3)

Use a dynamically updated setting:

{CheckboxBar[Dynamic[x],{1,2,3}],Dynamic[x]}

Use any expression as a value:

g=Plot[Sin[x],{x,0,2π},Axes->False,ImageSize->40];
f=(Sqrt[y])Tan[α y-β];
s="αβγ";

{CheckboxBar[Dynamic[x],{g,f,s}],Dynamic[x]}

Separate choices with a (RefLink[Delimiter, paclet:ref/Delimiter]):

CheckboxBar[{1},{1,2,Delimiter,3}]

OpenersExampleSection2(Spacer1)Options  (9)

OpenersExampleSubsection0(Spacer1)Appearance  (4)

Alter the size:

Table[CheckboxBar[{},{1,2,3},Appearance->a],{a,{Tiny,Small,Medium,Large}}]

Alter the orientation:

Table[CheckboxBar[{},{1,2,3},Appearance->a],{a,{"Horizontal","Vertical"}}]

Using the "Row" setting will allow the row of checkboxes to line break:

CheckboxBar[{},Range[15],Appearance->"Row"]

CheckboxBar[{},Range[15],Appearance->"Horizontal"]

Specify a three-column layout with elements ordered vertically:

CheckboxBar[Dynamic[props], CityData["Properties"],Appearance -> "Vertical" -> {Automatic,3}]

OpenersExampleSubsection1(Spacer1)Background  (2)

Table[CheckboxBar[{},{1,3,5,7},Background->c],{c,{Pink,Green,Gray,Yellow}}]

Change the background dynamically:

DynamicModule[{x={}},CheckboxBar[Dynamic[x],{0.1,0.25,0.3,0.8},Background->Dynamic[Hue[Total[x]]]]]

OpenersExampleSubsection2(Spacer1)BaselinePosition  (1)

Align the labels with surrounding text:

Row[Table[CheckboxBar[{},{1,2},BaselinePosition->p],{p,{Automatic,Bottom,Center,Top}}],"xxx"]

OpenersExampleSubsection3(Spacer1)Enabled  (1)

By default, (RefLink[CheckboxBar, paclet:ref/CheckboxBar]) is enabled:

CheckboxBar[{1,3},{1,2,3}]

By setting (RefLink[Enabled, paclet:ref/Enabled])->(RefLink[False, paclet:ref/False]), the checkbox bar is disabled but visible in its current state:

CheckboxBar[{1,3},{1,2,3},Enabled->False]

OpenersExampleSubsection4(Spacer1)Method  (1)

Normally, toggling the checkbox requires clicking the checkbox directly:

CheckboxBar[{},{"long label","another label"}]

With (RefLink[Method, paclet:ref/Method])->"Active", the label can also be clicked to toggle the checkbox:

CheckboxBar[{},{"long label","another label"},Method->"Active"]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

(RefLink[CheckboxBar, paclet:ref/CheckboxBar]) is a special case of (RefLink[TogglerBar, paclet:ref/TogglerBar]):

{CheckboxBar[Dynamic[x],Range[5]],Dynamic[x]}

{TogglerBar[Dynamic[y],Range[5]],Dynamic[y]}

(RefLink[CheckboxBar, paclet:ref/CheckboxBar]) is built using (RefLink[Checkbox, paclet:ref/Checkbox]) and can be used to track a list of values:

{CheckboxBar[Dynamic[x],Range[5]],Dynamic[x]}

{Checkbox[Dynamic[y]],Dynamic[y]}

OpenersExampleSection4(Spacer1)Possible Issues  (1)

Values are added in the order clicked rather than in the order given by the list of possible values:

{CheckboxBar[Dynamic[x],{1,2,3}],Dynamic[x]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TogglerBar, paclet:ref/TogglerBar])  ▪  (RefLink[RadioButtonBar, paclet:ref/RadioButtonBar])  ▪  (RefLink[Checkbox, paclet:ref/Checkbox])  ▪  (RefLink[ListPicker, paclet:ref/ListPicker])  ▪  (RefLink[Manipulate, paclet:ref/Manipulate])  ▪  (RefLink[Control, paclet:ref/Control])  ▪  (RefLink[AnySubset, paclet:ref/AnySubset])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Introduction to Dynamic, paclet:tutorial/IntroductionToDynamic])}, {▪(RefLinkPlain[Introduction to Control Objects, paclet:tutorial/IntroductionToControlObjects])}, {▪(RefLinkPlain[Generalized Input, paclet:tutorial/GeneralizedInput])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Control Objects, paclet:guide/ControlObjects])}, {▪(RefLinkPlain[User Interface Structuring & Layout, paclet:guide/UserInterfaceStructuringAndLayout])}})}})