({{, (RefLink[PopupMenu, paclet:ref/PopupMenu])[x,{(Subscript[val, 1]),(Subscript[val, 2]),…}]
represents a popup menu with setting x and possible values (Subscript[val, i]). }, {, (RefLink[PopupMenu, paclet:ref/PopupMenu])[(RefLink[Dynamic, paclet:ref/Dynamic])[x],{(Subscript[val, 1]),…}]
takes the setting to be the dynamically updated current value of x, with the value of x being reset every time an item is selected from the menu. }, {, (RefLink[PopupMenu, paclet:ref/PopupMenu])[x,{(Subscript[val, 1])->(Subscript[lbl, 1]),(Subscript[val, 2])->(Subscript[lbl, 2]),…}]
represents a popup menu in which possible value (Subscript[val, i]) is indicated by (Subscript[lbl, i]). }, {, (RefLink[PopupMenu, paclet:ref/PopupMenu])[x,{(Subscript[val, 1])->(Subscript[lbl, 1]),…},dlbl]
displays the menu item as dlbl if x is none of the (Subscript[val, i]). }, {, (RefLink[PopupMenu, paclet:ref/PopupMenu])[x,{…},dlbl,base]
displays as base when it is not being clicked. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[PopupMenu, paclet:ref/PopupMenu])[x,{(Subscript[val, 1]),(Subscript[val, 2]),…}] displays with the (Subscript[val, i]) as successive entries in the menu.

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

In (RefLink[PopupMenu, paclet:ref/PopupMenu])[x,list], (RefLink[Delimiter, paclet:ref/Delimiter]) can appear as an element of list, specifying a horizontal delimiter in the displayed popup menu.

The following options can be given:

(RefLink[Appearance, paclet:ref/Appearance])->{"Clicked"->(Subscript[app, 1]),"Unclicked"->(Subscript[app, 2])} allows different appearances to be specified for the clicked and unclicked states of the popup menu.

The settings for (RefLink[BaseStyle, paclet:ref/BaseStyle]) are appended to the default style typically given by the "PopupMenu" style in the current stylesheet.

OpenersPrimaryExamplesSection(Spacer1)Examples  (22)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Select values from a popup menu:

PopupMenu[a,{a,b,c,d}]

Connect (RefLink[PopupMenu, paclet:ref/PopupMenu]) to a dynamic state:

{PopupMenu[Dynamic[x],{a,b,c,d}],Dynamic[x]}

OpenersExampleSection1(Spacer1)Scope  (7)

OpenersExampleSubsection0(Spacer1)PopupMenu Content  (4)

Use graphics as content in (RefLink[PopupMenu, paclet:ref/PopupMenu]):

PopupMenu[Dynamic[x],Table[Plot[Sin[n x],{x,0,10}],{n,5}]]

Use any expression as a label:

{PopupMenu[Dynamic[y],Table[Plot[Sin[x^n],{x,0,2π}]->Sin[x^n],{n,5}]],Dynamic[y]}

Use (RefLink[Null, paclet:ref/Null]) to indicate a blank label:

{PopupMenu[Dynamic[x],{a->Null,b->"Some text"}],Dynamic[x]}

By default, a (RefLink[PopupMenu, paclet:ref/PopupMenu]) leaves enough space to display without ever resizing:

d=Table[Graphics[Circle[],ImageSize->s],{s,20,50,10}]

{PopupMenu[Graphics[Circle[],ImageSize->20],d],PopupMenu[Graphics[Circle[],ImageSize->50],d]}

With (RefLink[ImageSize, paclet:ref/ImageSize])->(RefLink[Automatic, paclet:ref/Automatic]), (RefLink[PopupMenu, paclet:ref/PopupMenu]) resizes for each pane:

{PopupMenu[Graphics[Circle[],ImageSize->20],d,ImageSize->Automatic],PopupMenu[Graphics[Circle[],ImageSize->50],d,ImageSize->Automatic]}

OpenersExampleSubsection1(Spacer1)PopupMenu Control  (3)

Start with value c selected:

PopupMenu[c,{a,b,c,d}]

The setting is based on value, regardless of labels:

{PopupMenu[Dynamic[x],{a,b,c}],Dynamic[x]}

{PopupMenu[Dynamic[y],{a->"one",b->"two",c->"three"}],Dynamic[y]}

Connect a (RefLink[PopupMenu, paclet:ref/PopupMenu]) to a slider:

{PopupMenu[Dynamic[i],{a,b,c,d}],Slider[Dynamic[i],{{a,b,c,d}}]}

OpenersExampleSection2(Spacer1)Options  (11)

OpenersExampleSubsection2(Spacer1)Alignment  (1)

Specify an alignment within the menu:

Grid[Table[PopupMenu[a,{a,b,c,d},ImageSize->{60,30},Alignment->{w,h}],{h,{Top,Center,Bottom}},{w,{Left,Center,Right}}]]

OpenersExampleSubsection3(Spacer1)AutoAction  (2)

By default, (RefLink[PopupMenu, paclet:ref/PopupMenu]) does not open until you click it:

PopupMenu[Dynamic[x],Table[Plot[BesselJ[n,x],{x,0,10}],{n,5}]]

By setting (RefLink[AutoAction, paclet:ref/AutoAction]), (RefLink[PopupMenu, paclet:ref/PopupMenu]) opens as the mouse moves over it:

PopupMenu[Dynamic[x],Table[Plot[BesselJ[n,x],{x,0,10}],{n,5}],AutoAction->True]

OpenersExampleSubsection4(Spacer1)BaselinePosition  (1)

Align with surrounding text:

Row[Table[PopupMenu[a,{a,b,c,d},BaselinePosition->p],{p,{Top,Center,Bottom}}],"xxx"]

OpenersExampleSubsection5(Spacer1)Enabled  (1)

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

PopupMenu[a,{a,b,c,d}]

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

PopupMenu[a,{a,b,c,d},Enabled->False]

OpenersExampleSubsection6(Spacer1)FieldSize  (3)

Use a predefined size:

Table[PopupMenu[a,{a,b,c,d},FieldSize->s],{s,{Tiny,Small,Medium,Large}}]

Specify width and height:

Grid[Table[PopupMenu[a,{a,b,c,d},FieldSize->{w,h}],{h,{1,2,4}},{w,{2,4,10}}]]

Allow a width and height between set values:

Column[Table[PopupMenu[N[Pi,n],{N[Pi,n],2,3,4},FieldSize->{{2,10},{1,2}}],{n,{4,15,25, 40}}]]

OpenersExampleSubsection7(Spacer1)FrameMargins  (1)

Add margins within the view:

Table[PopupMenu[a,{a,b,c,d},FrameMargins->m],{m,{0,10,20}}]

OpenersExampleSubsection8(Spacer1)ImageMargins  (1)

Add margins outside the view:

Table[Framed[PopupMenu[a,{a,b,c,d},ImageMargins->m]],{m,{0,10,20}}]

OpenersExampleSubsection9(Spacer1)ImageSize  (1)

Control the overall height and width:

Grid[Table[PopupMenu[a,{a,b,c,d},ImageSize->{w,h}],{h,{20,40,60}},{w,{40,60,80}}]]

OpenersExampleSection3(Spacer1)Applications  (1)

Dynamically update the base view:

PopupMenu[Dynamic[x],{1->"one",2->"two",3->"three"},1,Graphics[Dynamic[Table[Disk[{2i,0}],{i,x}]],ImageSize->{Dynamic[x]15,15}]]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

In (RefLink[PopupMenu, paclet:ref/PopupMenu]), the setting is associated with the value of the element in the list:

PopupMenu[a,{a,b,c,d}]

In (RefLink[PopupView, paclet:ref/PopupView]), the setting is associated with the position of the element in the list:

PopupView[{a,b,c,d},1]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SetterBar, paclet:ref/SetterBar])  ▪  (RefLink[RadioButtonBar, paclet:ref/RadioButtonBar])  ▪  (RefLink[PopupView, paclet:ref/PopupView])  ▪  (RefLink[ActionMenu, paclet:ref/ActionMenu])  ▪  (RefLink[ChoiceDialog, paclet:ref/ChoiceDialog])  ▪  (RefLink[Manipulate, paclet:ref/Manipulate])  ▪  (RefLink[Control, paclet:ref/Control])  ▪  (RefLink[InputField, paclet:ref/InputField])  ▪  (RefLink[Setter, paclet:ref/Setter])  ▪  (RefLink[Toggler, paclet:ref/Toggler])  ▪  (RefLink[FieldCompletionFunction, paclet:ref/FieldCompletionFunction])}})}})

({{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[Creating Form Interfaces & Apps, paclet:guide/CreatingFormsAndApps])}, {▪(RefLinkPlain[Form Structure & Layout, paclet:guide/FormStructureAndLayout])}, {▪(RefLinkPlain[Interactive Manipulation, paclet:guide/InteractiveManipulation])}, {▪(RefLinkPlain[Generalized Input, paclet:guide/GeneralizedInput])}, {▪(RefLinkPlain[Toolbars, paclet:guide/Toolbars])}, {▪(RefLinkPlain[Dynamic Interactivity Language, paclet:guide/DynamicInteractivityLanguage])}, {▪(RefLinkPlain[Palettes, paclet:guide/Palettes])}, {▪(RefLinkPlain[Creating Inspectors, paclet:guide/CreatingInspectors])}})}})