PadCodedocs

Picker

Choose one option from a list, shown as a menu, segments or a wheel.

Picker selected on the canvas, with its settings in the Inspector.

In the Library: Components → Controls · Needs PadCode Pro

#When to use it

Use a Picker to choose one option from a short list: a size, a category, a sort order. The choice stays shown, and it's saved into a variable. For on/off, use a Switch. For a list of actions people run, use a Menu.

#How to use it

  1. Add a Picker. It starts with Option 1, Option 2 and Option 3, and a variable selection that holds "Option 1".
  2. Under Options, type each choice. Add option adds one; the ⊖ button next to an option removes it.
  3. The option people pick is saved into the Selection variable as its text: picking "Large" saves "Large". To use a variable of your own, pick it in Selection.
  4. Choose a look under Control → Style, like Segmented for buttons side by side or Wheel.
  5. Read the choice anywhere by the variable's name, like {size} in a Text.
A Picker's Options in the Inspector.

#Example

A coffee order has a Picker with options Small, Medium and Large, Selection linked to a Text variable size, and Style set to Segmented. A Text below reads A {size} coffee, and another Text, "Large comes with an extra shot", has Show when set to size == "Large".

#Good to know

  • Add choices with Add option, not by adding views from the Library. Each option needs an Option Value, which Add option gives it.
  • Renaming the picked option, or removing it, updates the Selection variable to match.
  • The options can't be selected on the canvas. To style one, select it in Layers.
  • In the style it starts with, the Picker shows only the picked option, not its Title. Put a Text above it if people need a label.
  • Text + Icon + Views inside and Text + Image + Views inside put an icon, or one of your own pictures, beside the title, and Views inside + Custom content a title made of your own views. They show where the Picker shows its title: in a Form or a List.

#Add it

In the Library's Components tab, find Picker under Controls (or search for it) and either:

  • Tap it. It goes inside the selected container, at the end; right after the selected view, if that isn't a container; or at the bottom of the screen when nothing is selected.
  • Drag it onto the canvas, to exactly where you want it. A line shows where it will land.

#Made of

The Made of menu, at the top of its settings, picks which pieces it has. Switching keeps the settings the versions share.

  • Text + Views inside (where it starts)
  • Views inside + Custom content
  • Text + Image + Views inside
  • Text + Icon + Views inside

#Settings

In the Inspector's Style tab, top to bottom. Tap ⓘ next to a setting in the app for the same help.

#Picker

SettingWhat it doesHow you set itStarts as
TitleThe words shown on it. Put a variable in braces to show its value: Hello, {name}!Text box, or ⚡︎ to link a variableChoose
SelectionThe variable that keeps what's picked.Menu: pick a variable, or New Value to make oneselection, a variable PadCode makes for it
OptionsThe choices people pick from. The one they pick is saved into the Selection variable, as its text.Buttons: Remove option Option 2, Remove option Option 3, Add option—

#Text

Shared with other views: see Text.

SettingWhat it doesHow you set itStarts as
FontThe text style: Title, Headline, Body and so on. They grow with the size people set for text on their iPad.Menu: Large Title, Title, Title2, Title3, Headline, Subheadline, Body, Callout, Caption, Caption2, Footnote, CustomDefault
TypefaceThe letters' design: System (San Francisco), any font on the iPad, or a font file you add to this app.Opens a pickerSystem
WeightHow thick the letters are, from Light to Black.Menu: Default, Ultra Light, Thin, Light, Regular, Medium, Semibold, Bold, Heavy, BlackDefault
DesignThe letter shapes: Default, Rounded, Serif or Monospaced (every letter the same width).Menu: Default, Rounded, Serif, MonospacedDefault
ColorThe color of the text.Color menu, or the color wheelNone
AlignHow the lines of text line up: left, center or right.Buttons: Left, Center, Right—
Max linesHow many lines the text can use before it ends with “…”. Empty means no limit.Text boxNo limit
Letter spacingExtra space between letters, in points. A negative number squeezes them together.Text box0
CaseShows the text as typed, in UPPERCASE or in lowercase. The text itself doesn't change.Menu: As typed, Uppercase, LowercaseAs typed
Bold · Italic · Underline · StrikethroughButtons that turn bold, italic, underline and strikethrough on and off for the text.Four buttons, each on or off—

#Size & spacing

Shared with other views: see Size & spacing.

SettingWhat it doesHow you set itStarts as
PaddingEmpty space around the view, inside its background. One number for every side, like 16.Text boxNone
SidesPadding for one side only: T is the top, L the left, B the bottom, R the right.Text box—
WidthAuto fits the content. Fill takes all the room it can. Fixed sets an exact size in points.Menu: Auto, Fill, Fixed (then a number)Auto
HeightAuto fits the content. Fill takes all the room it can. Fixed sets an exact size in points.Menu: Auto, Fill, Fixed (then a number)Auto
OffsetNudges the view X points right and Y points down, without moving anything around it. Negative numbers go left and up.Text box—

#Look

Shared with other views: see Look.

SettingWhat it doesHow you set itStarts as
BackgroundA color behind the view. Add Padding so it doesn't hug the content.Color menu, or the color wheelNone
CornersRounds the background's corners, in points. 12 is gently rounded; a big number makes a pill.Text box0
BorderA line around the view, in the color you pick.Color menu, or the color wheelNone
ShadowA soft shadow under the view, so it looks raised.SwitchOff
OpacityHow solid the view is. All the way right is solid; all the way left is invisible.Slider100%
Liquid GlassApple's glass look: the view blurs and reflects what's behind it.SwitchOff

#Control

Shared with other views: see Control.

SettingWhat it doesHow you set itStarts as
StyleThe look iOS gives this control, like a filled or a plain button. Automatic lets iOS choose.Menu: Automatic, Inline, Menu, Navigation Link, Palette, Segmented, WheelAutomatic
AccentThe color of the control's active parts, like a switch when it's on.Color menu, or the color wheelNone
SizeHow big the control is: small, regular, large or extra large.Menu: Mini, Small, Regular, Large, Extra LargeRegular

#Show & enable

Closed at first. Show when shows the view only while a condition is true; Disabled grays it out. See Show & enable.

#All modifiers

Closed at first. Lists the modifiers on this view, in order, and adds more. It starts with none. See Modifiers.

Every setting of the Picker, top to bottom.

#Data

The Inspector's Data tab shows the variables this view reads or changes. Pick another variable from the menu, or make one.

SettingWhat it doesStarts as
SelectionThe variable that keeps what's picked.selection, a variable PadCode makes for it
RepeatShows the views inside once for every item in a list, like one row per task.Repeat for each item…
The Picker's Data tab.

#See also